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

className/Class<?> pairings not necessarily same as className/sourceCode #17

Open
kaya3 opened this issue Dec 8, 2017 · 0 comments
Open

Comments

@kaya3
Copy link

kaya3 commented Dec 8, 2017

Calling addSource("A", "class B {}"); addSource("B", "class A {}"); compileAll(); returns a Map of "A" to the class A and "B" to the class B. This is unexpected, and means that compileAll().get(className) won't necessarily return the class compiled from the source code for className.

This could cause problems if, for example, client code ensures that the source code for "A" declares a class with some property, and then expects compileAll().get("A") to return a class with that property.

A suggested fix is for the compileAll() method to check that the source code associated with each class name does declare a class of that name, and throw a CompilationException otherwise. This mirrors the behaviour of javac which requires a file named A.java to declare a class named A.

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