Tests invoking javac APIs were flaky because ClasspathAnalyzerTest
was using Gradle's ProjectBuilder, which appends tools.jar to
the system class loader. Other tests do not do that, and they
invoke javac APIs directly.
In some executions, this causes some javac classes to be loaded
from the system class loader (the one patched by Gradle), while
some of them will be loaded by UrlClassLoader which points to tools.jar
in java.home. Having javac classes from different class loaders causes
java.lang.IllegalAccessError as package private access across class loaders
is not allowed. https://bugs.openjdk.java.net/browse/JDK-8068152 has more
information on this issue.
This change fixes the issue by fully removing usage of ProjectBuilder.
Test: ClasspathAnalyzerTest
This is because AGP 3.4 and 3.6 have version of R8 that is unable
to handle kotlin-stdlib 1.6+. Issue https://issuetracker.google.com/148661132
has more details on this.
Instead of adding logic to remove assertions based on the AGP version,
this change fully removes them to keep things simple. Also, running with
assertions enabled may be too much for the integration tests.
See the class at org/jmock/Expectations
public <T> T with(Matcher<T> matcher);
public boolean with(Matcher<Boolean> matcher);
When we extending such class it we start assuming
that fake generic override overrides both of the overridden that is wrong
from POV of Java and it fails at FIR ultimate build
NB: It's hard to write a test because such Expectation-like
class is impossible to write in pure Java
Putting them in the local variable table means that the debugger
needs to have special handling for parameters with specific names.
That forces us to generate mangled names for these.
Instead of also implementing the name mangling for FIR, this
change gets rid of the parameters from the LVT instead.
Android Gradle plugin resolves the *Classpath configurations in an
artifact view with an artifactType attribute set, which should
give a resolved variant with a different `org.gradle.category`
attribute. With `org.gradle.category=library` set by the Kotlin
Gradle plugin, that couldn't work.
To fix this, don't set the `org.gradle.category` attribute on the
Android resolvable configurations.
TODO: Add integration tests!