Skip to content

Commit

Permalink
Fix ReloadableJavaXyTypeSignatureBuilder
Browse files Browse the repository at this point in the history
The change in the recent PR #4427 was a bit overly cautious. We should be able to use `?` as the name in the signature for all captured types.
  • Loading branch information
knutwannheden committed Aug 23, 2024
1 parent 1b487f5 commit be820fb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.openrewrite.java.isolated;

import com.sun.tools.javac.code.BoundKind;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.TypeTag;
Expand Down Expand Up @@ -141,12 +140,7 @@ public String classSignature(Object type) {
@Override
public String genericSignature(Object type) {
Type.TypeVar generic = (Type.TypeVar) type;
String name;
if (generic instanceof Type.CapturedType && ((Type.CapturedType) generic).wildcard.kind == BoundKind.UNBOUND) {
name = "?";
} else {
name = generic.tsym.name.toString();
}
String name = generic instanceof Type.CapturedType ? "?" : generic.tsym.name.toString();

if (typeVariableNameStack == null) {
typeVariableNameStack = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.openrewrite.java.isolated;

import com.sun.tools.javac.code.BoundKind;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.TypeTag;
Expand Down Expand Up @@ -141,12 +140,7 @@ public String classSignature(Object type) {
@Override
public String genericSignature(Object type) {
Type.TypeVar generic = (Type.TypeVar) type;
String name;
if (generic instanceof Type.CapturedType && ((Type.CapturedType) generic).wildcard.kind == BoundKind.UNBOUND) {
name = "?";
} else {
name = generic.tsym.name.toString();
}
String name = generic instanceof Type.CapturedType ? "?" : generic.tsym.name.toString();

if (typeVariableNameStack == null) {
typeVariableNameStack = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.openrewrite.java.isolated;

import com.sun.tools.javac.code.BoundKind;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.TypeTag;
Expand Down Expand Up @@ -141,12 +140,7 @@ public String classSignature(Object type) {
@Override
public String genericSignature(Object type) {
Type.TypeVar generic = (Type.TypeVar) type;
String name;
if (generic instanceof Type.CapturedType && ((Type.CapturedType) generic).wildcard.kind == BoundKind.UNBOUND) {
name = "?";
} else {
name = generic.tsym.name.toString();
}
String name = generic instanceof Type.CapturedType ? "?" : generic.tsym.name.toString();

if (typeVariableNameStack == null) {
typeVariableNameStack = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.openrewrite.java;

import com.sun.tools.javac.code.BoundKind;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.TypeTag;
Expand Down Expand Up @@ -140,12 +139,7 @@ public String classSignature(Object type) {
@Override
public String genericSignature(Object type) {
Type.TypeVar generic = (Type.TypeVar) type;
String name;
if (generic instanceof Type.CapturedType && ((Type.CapturedType) generic).wildcard.kind == BoundKind.UNBOUND) {
name = "?";
} else {
name = generic.tsym.name.toString();
}
String name = generic instanceof Type.CapturedType ? "?" : generic.tsym.name.toString();

if (typeVariableNameStack == null) {
typeVariableNameStack = new HashSet<>();
Expand Down

0 comments on commit be820fb

Please sign in to comment.