Skip to content

Commit

Permalink
Fix ASTConverter15JLS4Test.test0008
Browse files Browse the repository at this point in the history
Signed-off-by: Snjezana Peco <[email protected]>
  • Loading branch information
snjeza authored and mickaelistria committed Dec 23, 2024
1 parent 69a10fb commit 58c84f6
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ private ImportDeclaration convert(JCImport javac) {
ImportDeclaration res = this.ast.newImportDeclaration();
commonSettings(res, javac);
if (javac.isStatic()) {
if( this.ast.apiLevel != AST.JLS2_INTERNAL) {
if (this.ast.apiLevel != AST.JLS2_INTERNAL) {
res.setStatic(true);
}
}
Expand All @@ -397,6 +397,30 @@ private ImportDeclaration convert(JCImport javac) {
} else {
res.setName(toName(select));
}
if (javac.isStatic() || javac.isModule()) {
if (this.ast.apiLevel == AST.JLS2_INTERNAL) {
res.setFlags(res.getFlags() | ASTNode.MALFORMED);
} else if (this.ast.apiLevel < AST.JLS23_INTERNAL) {
if (!javac.isStatic()) {
res.setFlags(res.getFlags() | ASTNode.MALFORMED);
}
} else {
ModifierKeyword keyword = null;
if (javac.isStatic()) {
keyword = ModifierKeyword.STATIC_KEYWORD;
}
if (javac.isModule()) {
keyword = ModifierKeyword.MODULE_KEYWORD;
}
if (keyword != null) {
Modifier newModifier = this.ast.newModifier(keyword);
newModifier.setSourceRange(javac.getStartPosition(), keyword.toString().length());
res.modifiers().add(newModifier);
} else {
res.setFlags(res.getFlags() | ASTNode.MALFORMED);
}
}
}
return res;
}

Expand Down

0 comments on commit 58c84f6

Please sign in to comment.