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

Bug: Not allowed javaletter or keyword in identifier found #3951

Closed
djaekim opened this issue May 25, 2021 · 2 comments · Fixed by #3964
Closed

Bug: Not allowed javaletter or keyword in identifier found #3951

djaekim opened this issue May 25, 2021 · 2 comments · Fixed by #3964
Assignees
Labels

Comments

@djaekim
Copy link

djaekim commented May 25, 2021

Exception in thread "main" spoon.SpoonException: Not allowed javaletter or keyword in identifier found. See JLS for correct identifier. Identifier: IgniteCache<Long,Person>
        at spoon.support.reflect.reference.CtReferenceImpl.checkIdentiferForJLSCorrectness(CtReferenceImpl.java:108)
        at spoon.support.reflect.reference.CtReferenceImpl.setSimpleName(CtReferenceImpl.java:52)
        at spoon.support.compiler.jdt.ReferenceBuilder.getTypeReference(ReferenceBuilder.java:974)
        at spoon.support.compiler.jdt.ReferenceBuilder.getTypeReference(ReferenceBuilder.java:748)
        at spoon.support.compiler.jdt.ReferenceBuilder.getVariableReference(ReferenceBuilder.java:1057)
        at spoon.support.compiler.jdt.JDTTreeBuilderHelper.createVariableAccess(JDTTreeBuilderHelper.java:164)
        at spoon.support.compiler.jdt.JDTTreeBuilder.visit(JDTTreeBuilder.java:1535)
        at org.eclipse.jdt.internal.compiler.ast.SingleNameReference.traverse(SingleNameReference.java:1093)
        at org.eclipse.jdt.internal.compiler.ast.MessageSend.traverse(MessageSend.java:1170)
        at org.eclipse.jdt.internal.compiler.ast.Block.traverse(Block.java:154)
        at org.eclipse.jdt.internal.compiler.ast.TryStatement.traverse(TryStatement.java:1254)
        at org.eclipse.jdt.internal.compiler.ast.Block.traverse(Block.java:154)
        at org.eclipse.jdt.internal.compiler.ast.TryStatement.traverse(TryStatement.java:1254)
        at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:411)
        at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1689)
        at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:822)
        at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:783)
        at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.traverseUnitDeclaration(JDTBasedSpoonCompiler.java:480)
        at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.lambda$buildModel$0(JDTBasedSpoonCompiler.java:437)
        at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.forEachCompilationUnit(JDTBasedSpoonCompiler.java:464)
        at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildModel(JDTBasedSpoonCompiler.java:435)
        at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildUnitsAndModel(JDTBasedSpoonCompiler.java:372)
        at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildSources(JDTBasedSpoonCompiler.java:335)
        at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:116)
        at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:99)
        at spoon.Launcher.buildModel(Launcher.java:772)
        at main.app.main(app.java:625)

Occurs for apache/ignite@b1529fb

@slarse
Copy link
Collaborator

slarse commented May 25, 2021

Thanks for the bug report. This may be related to #3913.

@slarse slarse added the bug label May 25, 2021
@slarse slarse self-assigned this May 28, 2021
@slarse
Copy link
Collaborator

slarse commented May 28, 2021

I've figured out why this happens. When a generic type is instantiated in a try-with-resources, and it's not actually a closeable resource, JDT resolves it as a ProblemReferenceBinding with a compound name that includes the entire declaration (e.g. Type<K,V>) instead of a PrameterizedTypeBinding. It therefore fails the JLS identifier check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants