Skip to content

Commit

Permalink
Fix crash in Guava (#1622)
Browse files Browse the repository at this point in the history
The fix for #1587 caused another crash when type-checking Guava.  This fixes that crash.
  • Loading branch information
smillst authored Nov 1, 2017
1 parent 6eed5f0 commit 647526e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public AnnotatedTypeMirror substitute(
*
* @param argument the argument to declaration (this will be a value in typeParamToArg)
* @param use the use that is being replaced
* @return a shallow copy of argument with the appropriate annotations applied
* @return a deep copy of argument with the appropriate annotations applied
*/
protected AnnotatedTypeMirror substituteTypeVariable(
final AnnotatedTypeMirror argument, final AnnotatedTypeVariable use) {
final AnnotatedTypeMirror substitute = argument.shallowCopy(false);
final AnnotatedTypeMirror substitute = argument.deepCopy(true);
substitute.addAnnotations(argument.getAnnotationsField());

if (!use.getAnnotationsField().isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public AnnotatedTypeMerger(final AnnotationMirror top) {

@Override
protected Void compare(AnnotatedTypeMirror one, AnnotatedTypeMirror two) {
assert one != two;
if (one != null && two != null) {
replaceAnnotations(one, two);
}
Expand Down
11 changes: 11 additions & 0 deletions framework/tests/all-systems/Issue1587.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@ public void method(MyObject one) {
}

abstract Iterable<MyObject> g(Iterable<MyObject> r);

interface Class2<C, D extends Class2<C, D>> {}

static class Class1<A, B extends Class2<A, B>> {

static void test() {}

void use() {
Class1.test();
}
}
}

0 comments on commit 647526e

Please sign in to comment.