Hey, First I’d say try it on 1.9.2 as that includes an updated Eclipse JDT. I recall fixing something around source location lookups in 1.9.2, but can’t recall if it was for fields or not, might have been just types and the fix needs extending to fields. As it stands when I look at 1.9.1, line 425 isn’t a line that can NPE so an updated position for 1.9.2 would be nice. Feel free to raise a bug at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
That APT area is somewhat limited in test coverage, so I’m not surprised to hit some things if dabbling in that area. cheers Andy > On Oct 26, 2018, at 3:25 AM, Mikael Petterson <mikaelpetter...@hotmail.com> > wrote: > > Hi > > Sorry for spamming. > > I am using apsectjrt 1.9.1. > > For the below code we > > public List<String> getEnumValues(Element element) { > Element enumTypeElement = > getElementByClassName(element.asType().toString()); > Preconditions.checkArgument(enumTypeElement.getKind() == > ElementKind.ENUM); > return > FluentIterable.from(enumTypeElement.getEnclosedElements())//This is line 514. > .filter(ENUM_VALUE_PREDICATE) > .transform(Functions.toStringFunction()) > .toList(); > } > > we get the following output. > > java.lang.NullPointerException > at > org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding.sourceField(FieldBinding.java:425) > at > org.aspectj.org.eclipse.jdt.internal.compiler.apt.model.TypeElementImpl$SourceLocationComparator.determineSourceStart(TypeElementImpl.java:108) > at > org.aspectj.org.eclipse.jdt.internal.compiler.apt.model.TypeElementImpl$SourceLocationComparator.getSourceStart(TypeElementImpl.java:72) > at > org.aspectj.org.eclipse.jdt.internal.compiler.apt.model.TypeElementImpl$SourceLocationComparator.compare(TypeElementImpl.java:65) > at > org.aspectj.org.eclipse.jdt.internal.compiler.apt.model.TypeElementImpl$SourceLocationComparator.compare(TypeElementImpl.java:1) > at java.util.TimSort.countRunAndMakeAscending(TimSort.java:360) > at java.util.TimSort.sort(TimSort.java:220) > at java.util.Arrays.sort(Arrays.java:1512) > at java.util.ArrayList.sort(ArrayList.java:1454) > at java.util.Collections.sort(Collections.java:175) > at > org.aspectj.org.eclipse.jdt.internal.compiler.apt.model.TypeElementImpl.getEnclosedElements(TypeElementImpl.java:166) > at com.company.generator.util.ElementUtil.getEnumValues(ElementUtil.java:514) > > br, > > //mikael > > > > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org <mailto:aspectj-users@eclipse.org> > To change your delivery options, retrieve your password, or unsubscribe from > this list, visit > https://www.eclipse.org/mailman/listinfo/aspectj-users > <https://www.eclipse.org/mailman/listinfo/aspectj-users>
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/aspectj-users