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

Java import fails on qualified new operators #1144

Open
codemanyak opened this issue Mar 18, 2024 · 2 comments
Open

Java import fails on qualified new operators #1144

codemanyak opened this issue Mar 18, 2024 · 2 comments
Assignees
Milestone

Comments

@codemanyak
Copy link
Collaborator

codemanyak commented Mar 18, 2024

For see instantiation of nested static classes a qualified new operator may be needed (see e.g. https://stackoverflow.com/questions/2863157/how-does-object_new-work-does-java-have-a-new-operator).

If the Java parser bumps into such a qualified new operator it fails inevitably:

error.syntax in file "D:\SW-Produkte\Structorizer\tests\Issue1132_Java_import\parsers\COBOLParser.java"

Preceding source context:
 5762:       {
 5763:           // START KGU#537 2018-07-01: Enh. #553
 5764:           checkCancelled();
 5765:           // END KGU#537 2018-07-01
 5766:           if (_reduction.isEmpty()) {
 5767:               return;
 5768:           }
 5769:   
 5770:           // create a dummy-program because we may have only a partial source that doesn't start with 
     +   program definition
 5771:           if (currentProg == null) {
 5772:               currentProg = cobTools.» new CobProg(STRUCTORIZER_PARTIAL, null, false, null);

Found token new

Expected: Identifier

A grammar modification will be necessary to solve this problem.

@codemanyak codemanyak added the bug label Mar 18, 2024
@codemanyak codemanyak added this to the Release 3.33 milestone Mar 18, 2024
@codemanyak codemanyak self-assigned this Mar 18, 2024
@codemanyak
Copy link
Collaborator Author

codemanyak commented Mar 18, 2024

An apparently obvious approach to update the grammar caused normal object instantiation with type parameters to fail instead, which seems worse.

@codemanyak
Copy link
Collaborator Author

codemanyak commented Mar 18, 2024

There is no simple solution at hand (except that the preprocessor would simply delete the class path prefix), but the occurrence of qualified new operators seems unlikely enough to leave it as is.

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

No branches or pull requests

1 participant