Skip to content

Commit 4c34a2c

Browse files
committed
fix javadoc to remove warnings
1 parent da93c11 commit 4c34a2c

File tree

4 files changed

+83
-33
lines changed

4 files changed

+83
-33
lines changed

ref-code-adaptation/src/main/java/de/monticore/codeAdaption/matcher/MatcherHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public static List<ISymbol> cleanReferences(List<ISymbol> references) {
189189
return references;
190190
}
191191

192-
Set<ISymbol> temps = new HashSet(references);
192+
Set<ISymbol> temps = new HashSet<>(references);
193193
for (ISymbol symbol : temps) {
194194
for (ISymbol symbol1 : temps) {
195195
if (!symbol.equals(symbol1) && (matchInfix(symbol.getName(), symbol1.getName()))) {

ref-code-adaptation/src/main/java/de/monticore/codeAdaption/updater/spoonUpdater/SpoonUpdater.java

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,15 @@ public void setOutputDirectory(Path outputPath) {
169169
}
170170

171171
/***
172-
*get spoonType form the Spoon Model and the mcType.
173-
* save the found spoonType in the type map.
172+
* Retrieves the spoonType from the Spoon Model based on the provided mcType.
173+
* Saves the found spoonType in the type map.
174+
*
175+
* @param mcType The ASTTypeDeclaration representing the type to be searched
176+
* for in the Spoon model.
177+
* @return The corresponding CtType<?> found in the Spoon model for the
178+
* given mcType.
179+
* @throws AssertionError if no matching CtType<?> is found in the Spoon
180+
* model (assert will fail).
174181
*/
175182
private CtType<?> getSpoonType(ASTTypeDeclaration mcType) {
176183
// cas already found
@@ -184,10 +191,19 @@ private CtType<?> getSpoonType(ASTTypeDeclaration mcType) {
184191
typeMap.put(mcType, type.get());
185192
return type.get();
186193
}
187-
194+
188195
/***
189-
*get spoonMethod form the Spoon Model and the mcType an the mcMethod.
190-
* save the found spoonMethod in the type map.
196+
* Retrieves the spoonMethod from the Spoon Model based on the provided
197+
* mcType and mcMethod. Saves the found spoonMethod in the method map.
198+
*
199+
* @param mcType The ASTTypeDeclaration representing the type to which
200+
* the method belongs.
201+
* @param mcMethod The ASTMethodDeclaration representing the method to be
202+
* searched for in the Spoon model.
203+
* @return The corresponding CtMethod found in the Spoon model for the
204+
* given mcType and mcMethod.
205+
* @throws AssertionError if no matching CtMethod is found in the
206+
* Spoon model (assert will fail).
191207
*/
192208
public CtMethod<?> getSpoonMethod(ASTTypeDeclaration mcType, ASTMethodDeclaration mcMethod) {
193209
// cas method was already found
@@ -206,17 +222,30 @@ public CtMethod<?> getSpoonMethod(ASTTypeDeclaration mcType, ASTMethodDeclaratio
206222
methodMap.put(mcMethod, method.get());
207223
return method.get();
208224
}
209-
210-
/***
211-
* compare a mcType an spoonType and return true if both are identical.
225+
226+
/**
227+
* Compares a mcType and spoonType and returns true if both are identical.
228+
*
229+
* @param type The ASTTypeDeclaration representing the type to be compared.
230+
* @param spoonType The CtType representing the spoon type to be compared.
231+
* @return True if the file name of the mcType ends with the simple name
232+
* of the spoonType followed by ".java"; otherwise false.
212233
*/
213234
protected boolean compare(ASTTypeDeclaration type, CtType<?> spoonType) {
214235
String fileName = type.get_SourcePositionStart().getFileName().orElse(type.getName());
215236
return fileName.replaceAll("\\\\", ".").endsWith(spoonType.getSimpleName() + ".java");
216237
}
217-
218-
/***
219-
*compare spoonMethod and mcMethod and return true if both are identical.
238+
239+
/**
240+
* Compares a spoonMethod and mcMethod and returns true if both are
241+
* identical.
242+
*
243+
* @param mcMethod The ASTMethodDeclaration representing the method to be
244+
* compared.
245+
* @param spoonMethod The CtMethod representing the spoon method to be
246+
* compared.
247+
* @return True if the names, parameter count, and parameter types of both
248+
* methods match; otherwise false.
220249
*/
221250
protected boolean compare(ASTMethodDeclaration mcMethod, CtMethod<?> spoonMethod) {
222251
// compare names

ref-code-adaptation/src/main/java/de/monticore/codeAdaption/utils/AdapterUtils.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public static String getPosition(SourcePosition pos) {
4747
}
4848
return "";
4949
}
50-
51-
/***
52-
* read a java file an remove multilines an single lines comments.
50+
51+
/**
52+
* Reads a Java file and removes multi-line and single-line comments.
53+
*
54+
* @param file The Java file from which comments will be removed.
5355
*/
5456
public static void removeComments(File file) {
5557

ref-code-adaptation/src/main/java/de/monticore/codeAdaption/utils/JavaLoader.java

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,17 @@
3838
import org.junit.jupiter.api.Assertions;
3939

4040
public class JavaLoader {
41-
42-
/***
43-
*parse a class diagram, build the symbol table and check the cocos.
41+
42+
/**
43+
* Parses a class diagram, builds the symbol table, and checks the
44+
* consistency conditions (CoCos).
45+
*
46+
* @param file The class diagram file to be parsed. It must have a .cd
47+
* extension.
48+
* @return The resulting ASTCDCompilationUnit created from the class
49+
* diagram.
50+
* @throws AssertionError if the provided file does not have a .cd
51+
* extension, or if the AST could not be created successfully.
4452
*/
4553
public static ASTCDCompilationUnit loadCD(File file) {
4654
// parse the class diagram
@@ -97,9 +105,13 @@ private static void createCDSymTab(ASTCDCompilationUnit ast) {
97105
ast.accept(c.getTraverser());
98106
ast.setEnclosingScope(as);
99107
}
100-
101-
/***
102-
* loa a java files,transform it to an AST and creation symbol-tables.
108+
109+
/**
110+
* Loads a Java file, transforms it to an AST, and creates symbol tables.
111+
*
112+
* @param javaFile The Java file to be loaded and processed.
113+
* @return The resulting ASTOrdinaryCompilationUnit created from the
114+
* Java file.
103115
*/
104116
public static ASTOrdinaryCompilationUnit loadJava(File javaFile) {
105117
assertTrue(javaFile.getName().endsWith(".java"));
@@ -125,8 +137,13 @@ public static ASTOrdinaryCompilationUnit loadJava(File javaFile) {
125137

126138
return (ASTOrdinaryCompilationUnit) ast.get();
127139
}
128-
129-
/** print a javaASTNode */
140+
141+
/**
142+
* Prints a Java ASTNode as a formatted string.
143+
*
144+
* @param node The ASTNode to be printed.
145+
* @return A formatted string representation of the provided ASTNode.
146+
*/
130147
public static String print(ASTNode node) {
131148
JavaDSLFullPrettyPrinter prettyPrinter = new JavaDSLFullPrettyPrinter(new IndentPrinter());
132149
return prettyPrinter.prettyprint(node);
@@ -146,22 +163,24 @@ public static void writeFile(Path path, String content) {
146163
Log.error("Exception occur when writing the file " + path);
147164
}
148165
}
149-
150-
/***
151-
* read recursive all java files in a directory and its subdirectories.
152-
* @param directoryPath the root directory to read.
153-
* @return the set of Java files as AST
166+
167+
/**
168+
* Reads recursively all Java files in a directory and its subdirectories.
169+
*
170+
* @param directoryPath The root directory to read.
171+
* @return A set of Java files represented as ASTOrdinaryCompilationUnit.
154172
*/
155173
public static Set<ASTOrdinaryCompilationUnit> readJavaCode(Path directoryPath) {
156174
Set<File> res = new HashSet<>();
157175
readJavaCode(directoryPath, res);
158176
return res.stream().map(JavaLoader::loadJava).collect(Collectors.toSet());
159177
}
160-
161-
/***
162-
* read recursive all java files in a directory and its subdirectories.
163-
* @param directoryPath the root directory to read.
164-
* @return the set of Java files as files
178+
179+
/**
180+
* Reads recursively all Java files in a directory and its subdirectories.
181+
*
182+
* @param directoryPath The root directory to read.
183+
* @return A set of Java files as File objects.
165184
*/
166185
public static Set<File> readJavaFile(Path directoryPath) {
167186
Set<File> res = new HashSet<>();

0 commit comments

Comments
 (0)