Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8286399: Address possibly lossy conversions in JDK Build Tools #8706

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions make/jdk/src/classes/build/tools/charsetmapping/EUC_TW.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -119,7 +119,7 @@ static void genClass(String pkg, String args[]) throws Exception
indexC2B[e.cp>>8] = 1;
} else {
indexC2BSupp[(e.cp&0xffff)>>8] = 1;
suppFlag[e.bs] |= (1 << plane);
suppFlag[e.bs] |= (byte) (1 << plane);
}
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1273,7 +1273,7 @@ else if (c == '/') {
for (int i = 0; i < decisionPointList.size(); i++) {
int rowNum = decisionPointList.elementAt(i).intValue();
state = tempStateTable.elementAt(rowNum);
state[numCategories] |= END_STATE_FLAG;
state[numCategories] |= (short) END_STATE_FLAG;
if (sawEarlyBreak) {
state[numCategories] |= LOOKAHEAD_STATE_FLAG;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need a cast as well? and also other cases, e.g. line 1019: state[numCategories] = DONT_LOOP_FLAG;?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it doesn't. LOOKAHEAD_STATE_FLAG is defined as 0x2000 which is within the range of short. OTOH, END_STATE_FLAG is 0x8000 thus a lossy conversion.

}
@@ -1580,7 +1580,7 @@ private void backfillLoopingStates() {
}

// clear out the backfill part of the flag word
state[numCategories] &= ALL_FLAGS;
state[numCategories] &= (short) ALL_FLAGS;

// then fill all zero cells in the current state with values
// from the corresponding cells of the fromState