Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add missing javadoc on public methods #1843

Merged
merged 1 commit into from
Feb 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/spoon/compiler/builder/SourceOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ public SourceOptions() {
super(SourceOptions.class);
}

/** adds the given paths as concatenated string with File.pathSeparator as sources */
public T sources(String sources) {
if (sources == null || sources.isEmpty()) {
return myself;
}
return sources(sources.split(File.pathSeparator));
}

/** adds the given paths as sources */
public T sources(String... sources) {
if (sources == null || sources.length == 0) {
args.add(".");
Expand All @@ -46,6 +48,7 @@ public T sources(String... sources) {
return myself;
}

/** adds the given {@link spoon.compiler.SpoonFile} as sources */
public T sources(List<SpoonFile> sources) {
if (sources == null || sources.size() == 0) {
args.add(".");
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/spoon/reflect/factory/CoreFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ SourcePosition createSourcePosition(
CompilationUnit compilationUnit,
int startSource, int end, int[] lineSeparatorPositions);

/** Creates a source position that points to the given compilation unit */
SourcePosition createPartialSourcePosition(CompilationUnit compilationUnit);

/**
Expand Down Expand Up @@ -561,15 +562,21 @@ BodyHolderSourcePosition createBodyHolderSourcePosition(
*/
CtTypeReference createWildcardStaticTypeMemberReference();

/** Creates a Java 9 module */
CtModule createModule();

/** Creates a reference to a Java 9 module */
CtModuleReference createModuleReference();

/** Creates a "requires" directive for a Java 9 module file */
CtModuleRequirement createModuleRequirement();

/** Creates a "export" directive for a Java 9 module file */
CtPackageExport createPackageExport();

/** Creates a "provides" directive for a Java 9 module file */
CtProvidedService createProvidedService();

/** Creates a "uses" directive for a Java 9 module file */
CtUsedService createUsedService();
}
41 changes: 29 additions & 12 deletions src/main/java/spoon/reflect/factory/Factory.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,38 +134,55 @@ public interface Factory {
/** returns the Spoon model that has been built with this factory or one of its subfactories */
CtModel getModel();

CoreFactory Core(); // used 238 times
/** Access to {@link CoreFactory} subfactory */
CoreFactory Core();

/** Access to {@link TypeFactory} subfactory */
TypeFactory Type(); // used 107 times

/** Access to {@link EnumFactory} subfactory */
EnumFactory Enum();

Environment getEnvironment(); // used 71 times
/** Access to the {@link Environment} */
Environment getEnvironment();

PackageFactory Package(); // used 30 times
/** Access to {@link PackageFactory} subfactory */
PackageFactory Package();

CodeFactory Code(); // used 28 times
/** Access to {@link CodeFactory} subfactory */
CodeFactory Code();

ClassFactory Class(); // used 27 times
/** Access to {@link ClassFactory} subfactory */
ClassFactory Class();

FieldFactory Field(); // used 9 times
/** Access to {@link FieldFactory} subfactory */
FieldFactory Field();

ExecutableFactory Executable(); // used 8 times
/** Access to {@link ExecutableFactory} subfactory */
ExecutableFactory Executable();

CompilationUnitFactory CompilationUnit(); // used 7 times
/** Access to {@link CompilationUnitFactory} subfactory */
CompilationUnitFactory CompilationUnit();

/** Access to {@link InterfaceFactory} subfactory */
InterfaceFactory Interface();

MethodFactory Method(); // used 5 times
/** Access to {@link MethodFactory} subfactory */
MethodFactory Method();

AnnotationFactory Annotation(); // used 4 times
/** Access to {@link AnnotationFactory} subfactory */
AnnotationFactory Annotation();

EvalFactory Eval(); // used 4 times
/** Access to {@link EvalFactory} subfactory */
EvalFactory Eval();

ConstructorFactory Constructor(); // used 3 times
/** Access to {@link ConstructorFactory} subfactory */
ConstructorFactory Constructor();

/** Access to {@link QueryFactory} subfactory */
QueryFactory Query();

/** Access to {@link ModuleFactory} subfactory for Java 9 modules */
ModuleFactory Module();

/**
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/spoon/reflect/visitor/CtVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -479,15 +479,33 @@ <T, A extends T> void visitCtOperatorAssignment(
*/
void visitCtImport(CtImport ctImport);

/**
* Visits a module declaration
*/
void visitCtModule(CtModule module);

/**
* Visits a module reference
*/
void visitCtModuleReference(CtModuleReference moduleReference);

/**
* Visits a package export in a module declaration.
*/
void visitCtPackageExport(CtPackageExport moduleExport);

/**
* Visits a "require" directive in a module declaration.
*/
void visitCtModuleRequirement(CtModuleRequirement moduleRequirement);

/**
* Visits a "provides" directive in a module declaration.
*/
void visitCtProvidedService(CtProvidedService moduleProvidedService);

/**
* Visits a "uses" directive in a module declaration.
*/
void visitCtUsedService(CtUsedService usedService);
}
1 change: 1 addition & 0 deletions src/main/java/spoon/reflect/visitor/chain/CtConsumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
* @param <T> - the type of accepted elements
*/
public interface CtConsumer<T> {
/** Implement this method to do something with object "t" passed as parameter */
void accept(T t);
}
1 change: 1 addition & 0 deletions src/main/java/spoon/reflect/visitor/chain/CtFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
* @param <R> the type of the result of the function
*/
public interface CtFunction<T, R> {
/** Implement this method to transform the input typed by T into an object of type R */
R apply(T input);
}
1 change: 1 addition & 0 deletions src/main/java/spoon/support/visitor/SignaturePrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public <T> void visitCtExecutableReference(CtExecutableReference<T> reference) {
writeNameAndParameters(reference);
}

/** writes only the name and parameters' types */
public <T> void writeNameAndParameters(CtExecutableReference<T> reference) {
if (reference.isConstructor()) {
write(reference.getDeclaringType().getQualifiedName());
Expand Down
1 change: 1 addition & 0 deletions src/main/java/spoon/testing/utils/ProcessorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public static void process(Factory factory, Collection<Processor<?>> processors)
compiler.process(processors);
}

/** sets the fields of processor "p" given as parameter according to the properties */
public static void initProperties(Processor<?> p, ProcessorProperties properties) {
if (properties != null) {
for (Field f : RtHelper.getAllFields(p.getClass())) {
Expand Down