Clone
 

robert stupp <snazy@snazy.de> in Gradle

Let Gradle 6.0 work with Zinc 1.3.0

The current implementation of `org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory#getCompiler` calls `ZincUtil#getDefaultBridgeModule`,

which is an internal class, but more importantly, it's been removed in Zinc 1.3.0.

There is probably a better way to prevent the use of Zinc internal classes, but moving the functionality to determine the bridge module name

feels good enough and not too intrusive given the short time left for Gradle 6.0.

A quick try to pull in zinc 1.3.0 via the `zinc` configuration works with the patch, but fails without it.

Signed-off-by: Robert Stupp <snazy@snazy.de>

Improve incremental compilation for Java

This patch splits the collected dependencies found in a .class file into "accessible" and "private" dependencies.

* "Accessbile" dependencies are classes that belong to non-private fields, non-private method signatures, class signature ("extends", "implements") etc

* "Private" dependencies are classes that belong to private fields, private methods and classes used in method bodies (i.e. just in "the code")

The TL;DR of the approach is to change the algorithm in `ClassSetAnalysis.getRelevantDependents` to only recurse for "accessible" dependencies.

Goal by example:

Consider classes like

```

class A {

private B b

}

class B {

private C c

}

class C {

}

```

The previous algorithm in `ClassSetAnalysis.getRelevantDependents` would recompile all classes, if `C` was changed. The new algorithm recompiles

just `B` and `C`, because `C` has been changed and `B` uses `C`. But it doesn't recompile `A`, because `A` is not affected by the change. The same

is true, if `C` would have been only used in a method body of `B` or in the signature of a `private` function in `B`.

The algorithm properly handles changes to classes used in the following example:

```

public class SomeClass {

List<Integer> field = new LinkedList<Integer>();

private AccessedFromPrivateField accessedFromPrivateField;

AccessedFromPackagePrivateField someField;

private AccessedFromPrivateMethod accessedFromPrivateMethod() {

return null;

}

public String accessedFromPrivateMethodBody() {

return new AccessedFromPrivateMethodBody().toString();

}

private Set<String> stuff(HashMap<String, String> map) {

System.out.println(new Foo());

return new HashSet<String>();

}

private class Foo {

// Hint: this field won't appear in the ClassAnalysis for SomeClass

public AccessedFromPrivateClassPublicField anotherField;

public String toString() {

return "" + new AccessedFromPrivateClass();

}

}

}

```

Changes the serialization format of `ClassAnalysis` + `DependentsSet`

Signed-off-by: Robert Stupp <snazy@snazy.de>

  1. … 9 more files in changeset.
Add unit tests

Signed-off-by: Robert Stupp <snazy@snazy.de>

Add unit tests

Signed-off-by: Robert Stupp <snazy@snazy.de>

Prevent StackOverflowException caused by excessive 'or' via PatternMatcher

Signed-off-by: Robert Stupp <snazy@snazy.de>

Prevent StackOverflowException caused by excessive 'or' via PatternMatcher

Signed-off-by: Robert Stupp <snazy@snazy.de>