79674482

Date: 2025-06-21 14:00:20
Score: 1.5
Natty:
Report link

The issue occurred because, even after setting the bootClasspath to include the custom framework JAR containing hidden APIs, the Java compiler still failed to resolve them. This happened because a stripped-down version of the Android framework (such as android.jar or a renamed variant) was also present on the regular classpath. That stripped version doesn't include hidden APIs and was silently taking precedence during Java compilation. Kotlin was able to resolve the methods correctly because it relies on the full classpath, while Java strictly depends on bootClasspath and classpath. To resolve the issue, I explicitly removed the stripped framework JAR from the Java compiler’s classpath, ensuring that only my intended framework JAR was used. Once that was done, the hidden APIs were correctly recognized by the Java compiler. The key point is that setting bootClasspath is not enough—conflicting entries in the regular classpath must also be excluded to avoid shadowing.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Self-answer (0.5):
  • Single line (0.5):
  • Low reputation (0.5):
Posted by: smtrz