DevBoost / JaMoPP

JaMoPP can parse Java source and byte code into EMF-based models and vice versa. It preserves source formatting and can be used for code analysis and refactoring.
17 stars 18 forks source link

Potentiall NullPointerException in TypeParameterImpl#getBoundType() #21

Closed BenjaminKlatt closed 10 years ago

BenjaminKlatt commented 10 years ago

Code containing an annotation, with the annotation implementation not available to the parser can result in a NullPointerException.

In the method TypeParameterImpl getBoundType(), Line 421 of /org.emftext.language.java/src-gen/org/emftext/language/java/generics/impl/TypeParameterImpl.java (sorry code is not in GitHub, so not directly referenceable, the

((org.emftext.language.java.types.TypedElement)elementReference.getTarget()).getTypeReference()

might return null.

The rest of the code is only executed when argumentType is not null. So the code here can be easily modified without unwanted effects when a null check for the code mentioned above is introduced.

mirkoseifert commented 10 years ago

I can't find the mentioned line. At line 421 there is different code in my workspace. Also, a string search in TypeParameterImpl did not yield results for the given code fragment.

Can you give more details about the location of the code (e.g., surrounding code and the method)? Then I can fix this.

Thanks!

BenjaminKlatt commented 10 years ago

It's located at: /org.emftext.language.java/src-gen/org/emftext/language/java/generics/impl/TypeParameterImpl.java

I have copied the code generated in my environment as GIST: https://gist.github.com/BenjaminKlatt/8565890

you can find the appropriate code location here: https://gist.github.com/BenjaminKlatt/8565890#file-gistfile1-java-L421

mirkoseifert commented 10 years ago

Can you verify the fix?

BenjaminKlatt commented 10 years ago

based on the trunk update site?

mirkoseifert commented 10 years ago

Yes, but the builds are still running. Give Jenkins 10 more minutes :)

BenjaminKlatt commented 10 years ago

seems to work fine