Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

annotation null pointer exception when List is used as @JsonField in Eclipse #20

Closed
zhaojiac opened this issue Jan 27, 2015 · 8 comments

Comments

@zhaojiac
Copy link

The exception from the Eclipse .log file is as follows:

!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2015-01-27 00:48:04.922
!MESSAGE annotation exception: java.lang.NullPointerException cause: java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1234)
at java.util.regex.Matcher.reset(Matcher.java:308)
at java.util.regex.Matcher.(Matcher.java:228)
at java.util.regex.Pattern.matcher(Pattern.java:1088)
at java.util.Formatter.parse(Formatter.java:2515)
at java.util.Formatter.format(Formatter.java:2469)
at java.util.Formatter.format(Formatter.java:2423)
at java.lang.String.format(String.java:2790)
at com.instagram.javawriter.JavaWriter.emitStatement(JavaWriter.java:663)
at com.instagram.common.json.annotation.processor.JsonParserClassData.writeSerializeCalls(JsonParserClassData.java:514)
at com.instagram.common.json.annotation.processor.JsonParserClassData.access$200(JsonParserClassData.java:39)
at com.instagram.common.json.annotation.processor.JsonParserClassData$2.emitJava(JsonParserClassData.java:199)
at com.instagram.javawriter.JavaWriter.emitWithGenerator(JavaWriter.java:72)
at com.instagram.common.json.annotation.processor.JsonParserClassData.getJavaCode(JsonParserClassData.java:183)
at com.instagram.common.json.annotation.processor.JsonAnnotationProcessor.process(JsonAnnotationProcessor.java:101)
at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:139)
at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:121)
at org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:159)
at org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:134)
at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:820)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:434)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:366)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.compile(IncrementalImageBuilder.java:329)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:303)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:134)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:265)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:733)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:299)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:302)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:358)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:381)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

@ttung
Copy link
Contributor

ttung commented Jan 27, 2015

is this a transient issue due to incremental compilation?

@zhaojiac
Copy link
Author

zhaojiac commented Feb 3, 2015

@ttung Doesn't seem to be.... I tried to clean the project and rebuild which doesn't solve the issue.

@ttung
Copy link
Contributor

ttung commented Feb 3, 2015

Oh! Is your List type parameterized? It needs to be:

List<SomeType> foo;

SomeType either needs to be a type annotated with @jsontype or it needs to be an autoboxed primitive (like Integer, Float, etc)

@ttung
Copy link
Contributor

ttung commented Feb 5, 2015

Did that solve your problem, btw?

@zhaojiac
Copy link
Author

zhaojiac commented Feb 5, 2015

@ttung Thanks for the reply. It doesn't solve the issue. My List definitions are type parameterized. But you mention that it needs to be type annoated with @jsontype or primitives..... So Java class like String wouldn't work ?

@ttung
Copy link
Contributor

ttung commented Feb 5, 2015

Strings should work.

Do you get any errors when you build?

@kangzhang
Copy link
Contributor

@zhaojiac

Did you use guava's ImmutableList or some other List type that our parser can't handle? (Another user who hit similar exception used guava's ImmutablaList, I'm wondering if it's the case for you)

It would be helpful if you can paste your model class here so that we can repro the issue. I'd be happy to take a look.

@ghost
Copy link

ghost commented Aug 4, 2015

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

@ttung ttung closed this as completed Jul 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants