Skip to content

Commit c9b9234

Browse files
committed
WIP: Rename new classes
Signed-off-by: BoykoAlex <alex.boyko@broadcom.com>
1 parent 8fc2e5d commit c9b9234

File tree

11 files changed

+166
-168
lines changed

11 files changed

+166
-168
lines changed

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/ArrayTypeName.java renamed to headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/ArrayType.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*
2525
* @author Alex Boyko
2626
*/
27-
class ArrayTypeName implements JavaType {
27+
class ArrayType implements JavaType {
2828

2929
private final JavaType componentType;
3030
private final int dimensions;
@@ -35,7 +35,7 @@ class ArrayTypeName implements JavaType {
3535
* @param componentType the component (element) type
3636
* @param dimensions the number of array dimensions (must be &gt;= 1)
3737
*/
38-
public ArrayTypeName(JavaType componentType, int dimensions) {
38+
public ArrayType(JavaType componentType, int dimensions) {
3939
this.componentType = componentType;
4040
this.dimensions = dimensions;
4141
}
@@ -60,7 +60,7 @@ public String getDisplayName() {
6060
}
6161

6262
@Override
63-
public List<ClassName> getAllClassNames() {
63+
public List<ClassType> getAllClassNames() {
6464
return componentType.getAllClassNames();
6565
}
6666

@@ -78,7 +78,7 @@ public String toString() {
7878
public boolean equals(Object o) {
7979
if (this == o) return true;
8080
if (o == null || getClass() != o.getClass()) return false;
81-
ArrayTypeName that = (ArrayTypeName) o;
81+
ArrayType that = (ArrayType) o;
8282
return dimensions == that.dimensions && componentType.equals(that.componentType);
8383
}
8484

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/ClassName.java renamed to headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/ClassType.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,24 @@
2828
* Two constructor forms:
2929
* <ul>
3030
* <li>{@link #ClassName(String, String)} — top-level class with explicit package</li>
31-
* <li>{@link #ClassName(ClassName, String)} — inner class whose package is implied by the declaring class</li>
31+
* <li>{@link #ClassName(ClassType, String)} — inner class whose package is implied by the declaring class</li>
3232
* </ul>
3333
*
3434
* @author Alex Boyko
3535
*/
36-
class ClassName implements FullyQualifiedName {
36+
class ClassType implements FullyQualifiedType {
3737

3838
private final String packageName;
3939
private final String simpleName;
40-
private final ClassName declaringClass;
40+
private final ClassType declaringClass;
4141

4242
/**
4343
* Create a top-level class name with an explicit package.
4444
*
4545
* @param packageName the package name (e.g. {@code "java.util"}), empty string for default package
4646
* @param simpleName the simple class name (e.g. {@code "Map"})
4747
*/
48-
public ClassName(String packageName, String simpleName) {
48+
public ClassType(String packageName, String simpleName) {
4949
this.packageName = packageName != null ? packageName : "";
5050
this.simpleName = simpleName;
5151
this.declaringClass = null;
@@ -57,7 +57,7 @@ public ClassName(String packageName, String simpleName) {
5757
* @param declaringClass the declaring (outer) class (must not be {@code null})
5858
* @param simpleName the simple class name (e.g. {@code "Entry"})
5959
*/
60-
public ClassName(ClassName declaringClass, String simpleName) {
60+
public ClassType(ClassType declaringClass, String simpleName) {
6161
this.declaringClass = declaringClass;
6262
this.simpleName = simpleName;
6363
this.packageName = declaringClass.getPackageName();
@@ -79,7 +79,7 @@ public String getSimpleName() {
7979
/**
8080
* Returns the declaring (outer) class, or {@code null} for top-level types.
8181
*/
82-
public ClassName getDeclaringClass() {
82+
public ClassType getDeclaringClass() {
8383
return declaringClass;
8484
}
8585

@@ -112,7 +112,7 @@ public String getFullyQualifiedName() {
112112
}
113113

114114
@Override
115-
public List<ClassName> getAllClassNames() {
115+
public List<ClassType> getAllClassNames() {
116116
return List.of(this);
117117
}
118118

@@ -133,7 +133,7 @@ public String toString() {
133133
public boolean equals(Object o) {
134134
if (this == o) return true;
135135
if (o == null || getClass() != o.getClass()) return false;
136-
ClassName that = (ClassName) o;
136+
ClassType that = (ClassType) o;
137137
return simpleName.equals(that.simpleName)
138138
&& packageName.equals(that.packageName)
139139
&& Objects.equals(declaringClass, that.declaringClass);

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/FullyQualifiedName.java renamed to headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/FullyQualifiedType.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
* <p>
1616
* Implementations include:
1717
* <ul>
18-
* <li>{@link ClassName} — a non-parameterized class/interface type</li>
19-
* <li>{@link ParameterizedClassName} — a parameterized type with type arguments</li>
18+
* <li>{@link ClassType} — a non-parameterized class/interface type</li>
19+
* <li>{@link ParameterizedClassType} — a parameterized type with type arguments</li>
2020
* </ul>
2121
*
2222
* @author Alex Boyko
2323
*/
24-
interface FullyQualifiedName extends JavaType {
24+
interface FullyQualifiedType extends JavaType {
2525

2626
/**
2727
* Returns the full source-style type string using {@code .} for inner classes.

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/InjectBeanConstructorRefactoring.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ public TextEdit computeEdit() throws Exception {
167167
}
168168

169169
// Step 3: Add imports for all referenced class types (sorted so insertions are in order)
170-
List<ClassName> classNames = new ArrayList<>(beanType.getAllClassNames());
170+
List<ClassType> classNames = new ArrayList<>(beanType.getAllClassNames());
171171
classNames.sort((a, b) -> a.getFullyQualifiedName().compareTo(b.getFullyQualifiedName()));
172-
for (ClassName cn : classNames) {
172+
for (ClassType cn : classNames) {
173173
JdtRefactorUtils.addImport(rewrite, ast, cu, cn);
174174
}
175175

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/JavaType.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
* <p>
2323
* Implementations include:
2424
* <ul>
25-
* <li>{@link FullyQualifiedName} — sub-interface for class-like types with a fully qualified name</li>
26-
* <li>{@link ClassName} — a non-parameterized class/interface type</li>
27-
* <li>{@link ParameterizedClassName} — a parameterized type with type arguments</li>
28-
* <li>{@link WildcardName} — a wildcard type ({@code ?}, {@code ? extends X}, {@code ? super X})</li>
29-
* <li>{@link PrimitiveTypeName} — a primitive type ({@code int}, {@code boolean}, etc.)</li>
30-
* <li>{@link ArrayTypeName} — an array type ({@code String[]}, {@code int[][]}, etc.)</li>
25+
* <li>{@link FullyQualifiedType} — sub-interface for class-like types with a fully qualified name</li>
26+
* <li>{@link ClassType} — a non-parameterized class/interface type</li>
27+
* <li>{@link ParameterizedClassType} — a parameterized type with type arguments</li>
28+
* <li>{@link WildcardType} — a wildcard type ({@code ?}, {@code ? extends X}, {@code ? super X})</li>
29+
* <li>{@link PrimitiveType} — a primitive type ({@code int}, {@code boolean}, etc.)</li>
30+
* <li>{@link ArrayType} — an array type ({@code String[]}, {@code int[][]}, etc.)</li>
3131
* </ul>
3232
* <p>
3333
* Instances are created via the {@link #parse(String)} factory method, which accepts
@@ -56,14 +56,14 @@ public interface JavaType {
5656
String getDisplayName();
5757

5858
/**
59-
* Returns a flat list of all concrete {@link ClassName} instances referenced in this
59+
* Returns a flat list of all concrete {@link ClassType} instances referenced in this
6060
* type tree. This is used for import management — each class name in the list may
6161
* need an import statement.
6262
* <p>
6363
* Wildcards contribute nothing directly; parameterized types contribute their base
6464
* class plus recurse into type arguments. Primitives return an empty list.
6565
*/
66-
List<ClassName> getAllClassNames();
66+
List<ClassType> getAllClassNames();
6767

6868
/**
6969
* Builds a JDT AST {@link Type} node from this type model.
@@ -121,13 +121,13 @@ private static JavaType parseFromSignature(String sig) {
121121

122122
switch (kind) {
123123
case Signature.BASE_TYPE_SIGNATURE:
124-
return new PrimitiveTypeName(Signature.toString(sig));
124+
return new PrimitiveType(Signature.toString(sig));
125125

126126
case Signature.ARRAY_TYPE_SIGNATURE:
127127
int dimensions = Signature.getArrayCount(sig);
128128
String elementSig = Signature.getElementType(sig);
129129
JavaType componentType = parseFromSignature(elementSig);
130-
return new ArrayTypeName(componentType, dimensions);
130+
return new ArrayType(componentType, dimensions);
131131

132132
case Signature.CLASS_TYPE_SIGNATURE:
133133
return parseClassSignature(sig);
@@ -141,7 +141,7 @@ private static JavaType parseFromSignature(String sig) {
141141
}
142142

143143
/**
144-
* Parse a class type signature into a {@link ClassName} or {@link ParameterizedClassName}.
144+
* Parse a class type signature into a {@link ClassType} or {@link ParameterizedClassType}.
145145
* <p>
146146
* Uses {@link Signature#getTypeErasure(String)} to extract the raw class signature,
147147
* then {@link Signature#getSignatureQualifier(String)} and
@@ -158,7 +158,7 @@ private static JavaType parseClassSignature(String sig) {
158158
String classChain = Signature.getSignatureSimpleName(erasureSig);
159159

160160
// Build the ClassName chain by splitting on '.' (inner classes)
161-
ClassName className = buildClassNameFromChain(packageName, classChain);
161+
ClassType className = buildClassNameFromChain(packageName, classChain);
162162

163163
// Extract type arguments
164164
String[] typeArgSigs = Signature.getTypeArguments(sig);
@@ -167,33 +167,33 @@ private static JavaType parseClassSignature(String sig) {
167167
for (String argSig : typeArgSigs) {
168168
parsedArgs.add(parseFromSignature(argSig));
169169
}
170-
return new ParameterizedClassName(className, parsedArgs);
170+
return new ParameterizedClassType(className, parsedArgs);
171171
}
172172

173173
return className;
174174
}
175175

176176
/**
177-
* Build a {@link ClassName} from a package name and a class chain string.
177+
* Build a {@link ClassType} from a package name and a class chain string.
178178
* <p>
179179
* The class chain may contain {@code .} separators for inner classes
180180
* (e.g. {@code "Map.Entry"} or {@code "Outer.Middle.Inner"}).
181181
*
182182
* @param packageName the package name (e.g. {@code "java.util"}), or empty string
183183
* @param classChain the class name chain (e.g. {@code "Map"}, {@code "Map.Entry"})
184-
* @return the constructed {@link ClassName}
184+
* @return the constructed {@link ClassType}
185185
*/
186-
private static ClassName buildClassNameFromChain(String packageName, String classChain) {
186+
private static ClassType buildClassNameFromChain(String packageName, String classChain) {
187187
String[] parts = classChain.split("\\.");
188-
ClassName current = new ClassName(packageName, parts[0]);
188+
ClassType current = new ClassType(packageName, parts[0]);
189189
for (int i = 1; i < parts.length; i++) {
190-
current = new ClassName(current, parts[i]);
190+
current = new ClassType(current, parts[i]);
191191
}
192192
return current;
193193
}
194194

195195
/**
196-
* Parse a wildcard type signature into a {@link WildcardName}.
196+
* Parse a wildcard type signature into a {@link WildcardType}.
197197
* <p>
198198
* Wildcard signatures use:
199199
* <ul>
@@ -202,21 +202,21 @@ private static ClassName buildClassNameFromChain(String packageName, String clas
202202
* <li>{@code -<sig>} — lower-bounded wildcard ({@code ? super X})</li>
203203
* </ul>
204204
*/
205-
private static WildcardName parseWildcardSignature(String sig) {
205+
private static WildcardType parseWildcardSignature(String sig) {
206206
char first = sig.charAt(0);
207207
if (first == Signature.C_STAR) {
208208
// Unbounded wildcard: ?
209-
return new WildcardName(null, true);
209+
return new WildcardType(null, true);
210210
} else if (first == Signature.C_EXTENDS) {
211211
// Upper-bounded: ? extends X
212212
String boundSig = sig.substring(1);
213213
JavaType bound = parseFromSignature(boundSig);
214-
return new WildcardName(bound, true);
214+
return new WildcardType(bound, true);
215215
} else if (first == Signature.C_SUPER) {
216216
// Lower-bounded: ? super X
217217
String boundSig = sig.substring(1);
218218
JavaType bound = parseFromSignature(boundSig);
219-
return new WildcardName(bound, false);
219+
return new WildcardType(bound, false);
220220
}
221221
throw new IllegalArgumentException("Invalid wildcard signature: " + sig);
222222
}

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/JdtRefactorUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private JdtRefactorUtils() {
2828
}
2929

3030
/**
31-
* Add an import for the given {@link ClassName} to the compilation unit, unless
31+
* Add an import for the given {@link ClassType} to the compilation unit, unless
3232
* the import is unnecessary.
3333
* <p>
3434
* An import is considered unnecessary when any of the following is true:
@@ -48,7 +48,7 @@ private JdtRefactorUtils() {
4848
* @param cu the compilation unit
4949
* @param className the class name to import
5050
*/
51-
public static void addImport(ASTRewrite rewrite, AST ast, CompilationUnit cu, ClassName className) {
51+
public static void addImport(ASTRewrite rewrite, AST ast, CompilationUnit cu, ClassType className) {
5252
String packageName = className.getPackageName();
5353

5454
// Don't add import for java.lang types

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/ParameterizedClassName.java renamed to headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/ParameterizedClassType.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
/**
2424
* Represents a parameterized class type like {@code Map<String, List<Integer>>}.
2525
* <p>
26-
* Holds a {@link ClassName} (the type erasure) and a list of type arguments,
27-
* each of which is a {@link JavaType} (and can itself be a {@link ClassName},
28-
* {@link ParameterizedClassName}, or {@link WildcardName}).
26+
* Holds a {@link ClassType} (the type erasure) and a list of type arguments,
27+
* each of which is a {@link JavaType} (and can itself be a {@link ClassType},
28+
* {@link ParameterizedClassType}, or {@link WildcardType}).
2929
*
3030
* @author Alex Boyko
3131
*/
32-
class ParameterizedClassName implements FullyQualifiedName {
32+
class ParameterizedClassType implements FullyQualifiedType {
3333

34-
private final ClassName erasure;
34+
private final ClassType erasure;
3535
private final List<JavaType> typeArguments;
3636

3737
/**
@@ -40,15 +40,15 @@ class ParameterizedClassName implements FullyQualifiedName {
4040
* @param erasure the type erasure (e.g. {@code ClassName("java.util", "Map")})
4141
* @param typeArguments the type arguments (must not be empty)
4242
*/
43-
public ParameterizedClassName(ClassName erasure, List<JavaType> typeArguments) {
43+
public ParameterizedClassType(ClassType erasure, List<JavaType> typeArguments) {
4444
this.erasure = erasure;
4545
this.typeArguments = typeArguments != null ? Collections.unmodifiableList(typeArguments) : Collections.emptyList();
4646
}
4747

4848
/**
4949
* Returns the type erasure (the class name without type arguments).
5050
*/
51-
public ClassName getErasure() {
51+
public ClassType getErasure() {
5252
return erasure;
5353
}
5454

@@ -89,8 +89,8 @@ public String getFullyQualifiedName() {
8989
}
9090

9191
@Override
92-
public List<ClassName> getAllClassNames() {
93-
List<ClassName> result = new ArrayList<>();
92+
public List<ClassType> getAllClassNames() {
93+
List<ClassType> result = new ArrayList<>();
9494
// Add the erasure itself
9595
result.add(erasure);
9696
// Recurse into type arguments
@@ -120,7 +120,7 @@ public String toString() {
120120
public boolean equals(Object o) {
121121
if (this == o) return true;
122122
if (o == null || getClass() != o.getClass()) return false;
123-
ParameterizedClassName that = (ParameterizedClassName) o;
123+
ParameterizedClassType that = (ParameterizedClassType) o;
124124
return erasure.equals(that.erasure) && typeArguments.equals(that.typeArguments);
125125
}
126126

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/PrimitiveTypeName.java renamed to headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/jdt/refactoring/PrimitiveType.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import java.util.Set;
1616

1717
import org.eclipse.jdt.core.dom.AST;
18-
import org.eclipse.jdt.core.dom.PrimitiveType;
1918
import org.eclipse.jdt.core.dom.Type;
2019

2120
/**
@@ -25,7 +24,7 @@
2524
*
2625
* @author Alex Boyko
2726
*/
28-
class PrimitiveTypeName implements JavaType {
27+
class PrimitiveType implements JavaType {
2928

3029
private static final Set<String> PRIMITIVE_KEYWORDS = Set.of(
3130
"boolean", "byte", "char", "short", "int", "long", "float", "double", "void");
@@ -37,7 +36,7 @@ class PrimitiveTypeName implements JavaType {
3736
*
3837
* @param keyword the primitive keyword (e.g. {@code "int"}, {@code "boolean"})
3938
*/
40-
public PrimitiveTypeName(String keyword) {
39+
public PrimitiveType(String keyword) {
4140
this.keyword = keyword;
4241
}
4342

@@ -54,13 +53,13 @@ public String getDisplayName() {
5453
}
5554

5655
@Override
57-
public List<ClassName> getAllClassNames() {
56+
public List<ClassType> getAllClassNames() {
5857
return Collections.emptyList();
5958
}
6059

6160
@Override
6261
public Type toType(AST ast) {
63-
return ast.newPrimitiveType(PrimitiveType.toCode(keyword));
62+
return ast.newPrimitiveType(org.eclipse.jdt.core.dom.PrimitiveType.toCode(keyword));
6463
}
6564

6665
@Override
@@ -72,7 +71,7 @@ public String toString() {
7271
public boolean equals(Object o) {
7372
if (this == o) return true;
7473
if (o == null || getClass() != o.getClass()) return false;
75-
PrimitiveTypeName that = (PrimitiveTypeName) o;
74+
PrimitiveType that = (PrimitiveType) o;
7675
return keyword.equals(that.keyword);
7776
}
7877

0 commit comments

Comments
 (0)