question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NoSuchFieldError: savedParameterNames

See original GitHub issue

There is a reference to com.sun.tools.javac.code.Symbol.MethodSymbol.savedParameterNames in MethodExtractorUtils:

https://github.com/facebook/litho/blob/ce87d198c8f5ac0cee2c9302cb48076b06253ef6/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/MethodExtractorUtils.java#L99

That field is an internal implementation detail of javac and is not part of the supported API. It is being removed in JDK 10. See this change: http://hg.openjdk.java.net/jdk/jdk/rev/89f6aa26fd6c, which fixes JDK-8177486 and JDK-8007720.

The removal of the field causes DelegateMethodExtractor to crash when running on a JDK 10 javac:

Caused by: java.lang.NoSuchFieldError: savedParameterNames
	at com.facebook.litho.specmodels.processor.MethodExtractorUtils.getSavedParameterNames(MethodExtractorUtils.java:87)
	at com.facebook.litho.specmodels.processor.MethodExtractorUtils.getMethodParams(MethodExtractorUtils.java:45)
	at com.facebook.litho.specmodels.processor.DelegateMethodExtractor.getDelegateMethods(DelegateMethodExtractor.java:63)
	at com.facebook.litho.specmodels.processor.LayoutSpecModelFactory.create(LayoutSpecModelFactory.java:79)
	at com.facebook.litho.specmodels.processor.LayoutSpecModelFactory.create(LayoutSpecModelFactory.java:33)
	at com.facebook.litho.specmodels.processor.AbstractComponentsProcessor.process(AbstractComponentsProcessor.java:66)
	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:969)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
cushoncommented, Jan 3, 2018

Thanks - that achieves binary compatibility with JDK 10, but not source compatibility. WDYT about Symbol.MethodSymbol.class.getField("savedParameterNames").get(methodSymbol)?

1reaction
cushoncommented, Dec 29, 2017

@pavlospt thanks for catching that. As I mentioned in the compiler-dev thread I think the patch is OK, and the index that isn’t incremented is effectively dead code.

For JDK 10 it should be sufficient to compile with -parameters and then use the names on the symbols returned by getParameters(). With JDK 8 and 9 some of the litho tests were running into JDK-8007720 - normally savedParameterNames should be null by the time annotation processing happens.

Read more comments on GitHub >

github_iconTop Results From Across the Web

debugging - NoSuchFieldError Java - Stack Overflow
I am getting a NoSuchFieldError in my code, now oracle isn't very clear about why this error is thrown only saying: this error...
Read more >
java.lang.NoSuchFieldError: INSTANCE - Hibernate Forums
Getting this error. ... Done some googling and found this error is usually caused by a conflict between jars in the classpath from...
Read more >
Error when creating new AndroidDriver object: java.lang ...
Error when creating new AndroidDriver object: java.lang.NoSuchFieldError: INSTANCE org.apache.http.conn.ssl.SSLConnectionSocketFactory.
Read more >
java.lang.NoSuchFieldError: firstLoad - Support & Bug ...
When I launch the FTB skyfactory 3 it saids "The game crashed whilst initializing gameError: java.lang.NoSuchFieldError: firstLoad" and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found