Diff (final Proto past) { final ClassRepr pastClass = (ClassRepr)past; final Difference diff = super.difference(past); int base = diff.base(); if (!mySuperClass.equals(pastClass.mySuperClass)) { base |= Difference.SUPERCLASS; } if (!getUsages().equals(pastClass.getUsages())) { base |= Difference.USAGES; } if (hasInlinedConstants() != pastClass.hasInlinedConstants()) { base |= Difference.CONSTANT_REFERENCES; } final int d = base; return new Diff(diff) { @Override public boolean extendsAdded() { if ((d & Difference.SUPERCLASS) <= 0) { return false; } final String pastSuperName = myContext.getValue(((ClassRepr)past).mySuperClass.className); return "java/lang/Object".equals(pastSuperName); } @Override public Difference.Specifier<TypeRepr.ClassType, Difference> interfaces() { return Difference.make(pastClass.myInterfaces, myInterfaces); } @Override public Difference.Specifier<FieldRepr, Difference> fields() { return Difference.make(pastClass.myFields, myFields); } @Override public Difference.Specifier<MethodRepr, MethodRepr.Diff> methods() { return Difference.make(pastClass.myMethods, myMethods); } @Override public Specifier<ElemType, Difference> targets() { return Difference.make(pastClass.myAnnotationTargets, myAnnotationTargets); } @Override public boolean retentionChanged() { return !((myRetentionPolicy == null && pastClass.myRetentionPolicy == RetentionPolicy.CLASS) || (myRetentionPolicy == RetentionPolicy.CLASS && pastClass.myRetentionPolicy == null) || (myRetentionPolicy == pastClass.myRetentionPolicy)); } @Override public boolean targetAttributeCategoryMightChange() { final Specifier<ElemType, Difference> targetsDiff = targets(); if (!targetsDiff.unchanged()) { for (ElemType elemType : Set.of(ElemType.TYPE_USE, ElemType.RECORD_COMPONENT)) { if (targetsDiff.added().contains(elemType) || targetsDiff.removed().contains(elemType) || pastClass.getAnnotationTargets().contains(elemType) ) { return true; } } } return false; } @Override public int base() { return d; } @Override public boolean hadValue() { return false; } }; }