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

ArrayIndexOutOfBoundsException with wildcard import and package name in super class #759

Closed
msteinbeck opened this issue Jul 22, 2016 · 1 comment

Comments

@msteinbeck
Copy link
Contributor

The following example causes an ArrayIndexOutOfBoundsException while create a spoon model:

import antlr.*;

public class FindImportBug extends antlr.LLkParser {
    public static void main(final String[] args) {}
}

The model is created as follows:
(with projectPath being the path to the FindImportBug.java file)

Launcher runLaunch = new Launcher();
runLaunch.getEnvironment().setNoClasspath(true);
runLaunch.addInputResource(projectPath);
runLaunch.buildModel();

I think this issue could be solved by checking the length chars. That is, findImport(chars, false, false); is skipped if chars.length == 0 .

msteinbeck pushed a commit to msteinbeck/spoon that referenced this issue Jul 22, 2016
`findImport` and `createPackage` require an array with a minimum
length of 1. This patch skips the method calls if necessary and
properly redirects to the fall back.
@msteinbeck
Copy link
Contributor Author

A potential fix is given in: #760

msteinbeck pushed a commit to msteinbeck/spoon that referenced this issue Jul 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant