Skip to content

Commit

Permalink
Make a first attempt at better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
matozoid committed Nov 28, 2016
1 parent 6738e1c commit 69c6a76
Show file tree
Hide file tree
Showing 44 changed files with 639 additions and 577 deletions.
3 changes: 2 additions & 1 deletion javaparser-core/bnd.bnd
Expand Up @@ -11,7 +11,8 @@ Bundle-SymbolicName: com.github.javaparser.javaparser-core
com.github.javaparser.ast.expr, \
com.github.javaparser.ast.stmt, \
com.github.javaparser.ast.type, \
com.github.javaparser.ast.visitor
com.github.javaparser.ast.visitor, \
com.github.javaparser.ast.observing

# Don't use the project's version for the packages
# We prefer not setting a version as we don't follow OSGi version semantics
Expand Down
Expand Up @@ -3,29 +3,29 @@
import java.util.EnumSet;

public enum Modifier {
PUBLIC("public"),
PUBLIC("public"),
PROTECTED("protected"),
PRIVATE("private"),
PRIVATE("private"),
ABSTRACT("abstract"),
STATIC("static"),
FINAL("final"),
TRANSIENT("transient"),
STATIC("static"),
FINAL("final"),
TRANSIENT("transient"),
VOLATILE("volatile"),
SYNCHRONIZED("synchronized"),
NATIVE("native"),
STRICTFP("strictfp");
SYNCHRONIZED("synchronized"),
NATIVE("native"),
STRICTFP("strictfp");

String lib;
String asString;

private Modifier(String lib) {
this.lib = lib;
Modifier(String asString) {
this.asString = asString;
}

/**
* @return the lib
* @return the keyword represented by this modifier.
*/
public String getLib() {
return lib;
public String asString() {
return asString;
}

public EnumSet<Modifier> toEnumSet() {
Expand Down
Expand Up @@ -49,14 +49,14 @@ public final class ClassOrInterfaceDeclaration extends TypeDeclaration<ClassOrIn
NodeWithExtends<ClassOrInterfaceDeclaration>,
NodeWithTypeParameters<ClassOrInterfaceDeclaration> {

private boolean interface_;
private boolean isInterface;

private NodeList<TypeParameter> typeParameters;

// Can contain more than one item if this is an interface
private NodeList<ClassOrInterfaceType> extendsList;
private NodeList<ClassOrInterfaceType> extendedTypes;

private NodeList<ClassOrInterfaceType> implementsList;
private NodeList<ClassOrInterfaceType> implementedTypes;

public ClassOrInterfaceDeclaration() {
this(null,
Expand Down Expand Up @@ -87,24 +87,24 @@ public ClassOrInterfaceDeclaration(final EnumSet<Modifier> modifiers,
final NodeList<AnnotationExpr> annotations, final boolean isInterface,
final SimpleName name,
final NodeList<TypeParameter> typeParameters,
final NodeList<ClassOrInterfaceType> extendsList,
final NodeList<ClassOrInterfaceType> implementsList,
final NodeList<ClassOrInterfaceType> extendedTypes,
final NodeList<ClassOrInterfaceType> implementedTypes,
final NodeList<BodyDeclaration<?>> members) {
this(null, modifiers, annotations, isInterface, name, typeParameters, extendsList, implementsList, members);
this(null, modifiers, annotations, isInterface, name, typeParameters, extendedTypes, implementedTypes, members);
}

public ClassOrInterfaceDeclaration(Range range, final EnumSet<Modifier> modifiers,
final NodeList<AnnotationExpr> annotations, final boolean isInterface,
final SimpleName name,
final NodeList<TypeParameter> typeParameters,
final NodeList<ClassOrInterfaceType> extendsList,
final NodeList<ClassOrInterfaceType> implementsList,
final NodeList<ClassOrInterfaceType> extendedTypes,
final NodeList<ClassOrInterfaceType> implementedTypes,
final NodeList<BodyDeclaration<?>> members) {
super(range, annotations, modifiers, name, members);
setInterface(isInterface);
setTypeParameters(typeParameters);
setExtends(extendsList);
setImplements(implementsList);
setExtends(extendedTypes);
setImplements(implementedTypes);
}

@Override
Expand All @@ -119,41 +119,41 @@ public <A> void accept(final VoidVisitor<A> v, final A arg) {

@Override
public NodeList<ClassOrInterfaceType> getExtends() {
return extendsList;
return extendedTypes;
}

@Override
public NodeList<ClassOrInterfaceType> getImplements() {
return implementsList;
return implementedTypes;
}

public NodeList<TypeParameter> getTypeParameters() {
return typeParameters;
}

public boolean isInterface() {
return interface_;
return isInterface;
}

@Override
public ClassOrInterfaceDeclaration setExtends(final NodeList<ClassOrInterfaceType> extendsList) {
notifyPropertyChange(ObservableProperty.EXTENDS, this.extendsList, extendsList);
this.extendsList = assertNotNull(extendsList);
setAsParentNodeOf(this.extendsList);
notifyPropertyChange(ObservableProperty.EXTENDED_TYPES, this.extendedTypes, extendsList);
this.extendedTypes = assertNotNull(extendsList);
setAsParentNodeOf(this.extendedTypes);
return this;
}

@Override
public ClassOrInterfaceDeclaration setImplements(final NodeList<ClassOrInterfaceType> implementsList) {
notifyPropertyChange(ObservableProperty.IMPLEMENTS_LIST, this.implementsList, implementsList);
this.implementsList = assertNotNull(implementsList);
setAsParentNodeOf(this.implementsList);
notifyPropertyChange(ObservableProperty.IMPLEMENTED_TYPES, this.implementedTypes, implementsList);
this.implementedTypes = assertNotNull(implementsList);
setAsParentNodeOf(this.implementedTypes);
return this;
}

public ClassOrInterfaceDeclaration setInterface(final boolean interface_) {
notifyPropertyChange(ObservableProperty.INTERFACE, this.interface_, interface_);
this.interface_ = interface_;
notifyPropertyChange(ObservableProperty.IS_INTERFACE, this.isInterface, interface_);
this.isInterface = interface_;
return this;
}

Expand All @@ -169,8 +169,8 @@ public ClassOrInterfaceDeclaration setTypeParameters(final NodeList<TypeParamete
public List<NodeList<?>> getNodeLists() {
List<NodeList<?>> res = new LinkedList<>(super.getNodeLists());
res.add(typeParameters);
res.add(extendsList);
res.add(implementsList);
res.add(extendedTypes);
res.add(implementedTypes);
return res;
}
}
Expand Up @@ -63,7 +63,7 @@ public final class ConstructorDeclaration extends BodyDeclaration<ConstructorDec

private NodeList<Parameter> parameters;

private NodeList<ReferenceType<?>> throws_;
private NodeList<ReferenceType<?>> thrownTypes;

private BlockStmt body;

Expand Down Expand Up @@ -91,27 +91,27 @@ public ConstructorDeclaration(EnumSet<Modifier> modifiers, String name) {

public ConstructorDeclaration(EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations,
NodeList<TypeParameter> typeParameters,
SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType<?>> throws_,
SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType<?>> thrownTypes,
BlockStmt block) {
this(null,
modifiers,
annotations,
typeParameters,
name,
parameters,
throws_,
thrownTypes,
block);
}

public ConstructorDeclaration(Range range, EnumSet<Modifier> modifiers,
NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name,
NodeList<Parameter> parameters, NodeList<ReferenceType<?>> throws_, BlockStmt block) {
NodeList<Parameter> parameters, NodeList<ReferenceType<?>> thrownTypes, BlockStmt block) {
super(range, annotations);
setModifiers(modifiers);
setTypeParameters(typeParameters);
setName(name);
setParameters(parameters);
setThrows(throws_);
setThrownTypes(thrownTypes);
setBody(block);
}

Expand Down Expand Up @@ -147,8 +147,8 @@ public NodeList<Parameter> getParameters() {
}

@Override
public NodeList<ReferenceType<?>> getThrows() {
return throws_;
public NodeList<ReferenceType<?>> getThrownTypes() {
return thrownTypes;
}

public NodeList<TypeParameter> getTypeParameters() {
Expand Down Expand Up @@ -178,10 +178,10 @@ public ConstructorDeclaration setParameters(NodeList<Parameter> parameters) {
}

@Override
public ConstructorDeclaration setThrows(NodeList<ReferenceType<?>> throws_) {
notifyPropertyChange(ObservableProperty.THROWS, this.throws_, throws_);
this.throws_ = assertNotNull(throws_);
setAsParentNodeOf(this.throws_);
public ConstructorDeclaration setThrownTypes(NodeList<ReferenceType<?>> thrownTypes) {
notifyPropertyChange(ObservableProperty.THROWN_TYPES, this.thrownTypes, thrownTypes);
this.thrownTypes = assertNotNull(thrownTypes);
setAsParentNodeOf(this.thrownTypes);
return this;
}

Expand Down Expand Up @@ -225,7 +225,7 @@ public String getDeclarationAsString(boolean includingModifiers, boolean includi
sb.append(")");
if (includingThrows) {
boolean firstThrow = true;
for (ReferenceType thr : getThrows()) {
for (ReferenceType thr : getThrownTypes()) {
if (firstThrow) {
firstThrow = false;
sb.append(" throws ");
Expand Down Expand Up @@ -273,7 +273,7 @@ public List<NodeList<?>> getNodeLists() {
List<NodeList<?>> res = new LinkedList<>(super.getNodeLists());
res.add(typeParameters);
res.add(parameters);
res.add(throws_);
res.add(thrownTypes);
return res;
}
}
Expand Up @@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/

package com.github.javaparser.ast.body;

import com.github.javaparser.Range;
Expand All @@ -42,43 +42,43 @@
/**
* @author Julio Vilmar Gesser
*/
public final class EnumConstantDeclaration extends BodyDeclaration<EnumConstantDeclaration> implements
public final class EnumConstantDeclaration extends BodyDeclaration<EnumConstantDeclaration> implements
NodeWithJavaDoc<EnumConstantDeclaration>,
NodeWithSimpleName<EnumConstantDeclaration>,
NodeWithArguments<EnumConstantDeclaration> {

private SimpleName name;

private NodeList<Expression> args;
private NodeList<Expression> arguments;

private NodeList<BodyDeclaration<?>> classBody;

public EnumConstantDeclaration() {
this(null,
new NodeList<>(),
this(null,
new NodeList<>(),
new SimpleName(),
new NodeList<>(),
new NodeList<>());
}

public EnumConstantDeclaration(String name) {
this(null,
this(null,
new NodeList<>(),
new SimpleName(name),
new NodeList<>(),
new NodeList<>());
}

public EnumConstantDeclaration(NodeList<AnnotationExpr> annotations, SimpleName name, NodeList<Expression> args,
public EnumConstantDeclaration(NodeList<AnnotationExpr> annotations, SimpleName name, NodeList<Expression> arguments,
NodeList<BodyDeclaration<?>> classBody) {
this(null, annotations, name, args, classBody);
this(null, annotations, name, arguments, classBody);
}

public EnumConstantDeclaration(Range range, NodeList<AnnotationExpr> annotations, SimpleName name, NodeList<Expression> args,
public EnumConstantDeclaration(Range range, NodeList<AnnotationExpr> annotations, SimpleName name, NodeList<Expression> arguments,
NodeList<BodyDeclaration<?>> classBody) {
super(range, annotations);
setName(name);
setArgs(args);
setArguments(arguments);
setClassBody(classBody);
}

Expand All @@ -92,8 +92,8 @@ public <A> void accept(VoidVisitor<A> v, A arg) {
v.visit(this, arg);
}

public NodeList<Expression> getArgs() {
return args;
public NodeList<Expression> getArguments() {
return arguments;
}

public NodeList<BodyDeclaration<?>> getClassBody() {
Expand All @@ -105,17 +105,17 @@ public SimpleName getName() {
return name;
}

public EnumConstantDeclaration setArgs(NodeList<Expression> args) {
notifyPropertyChange(ObservableProperty.ARGS, this.args, args);
this.args = assertNotNull(args);
setAsParentNodeOf(this.args);
public EnumConstantDeclaration setArguments(NodeList<Expression> arguments) {
notifyPropertyChange(ObservableProperty.ARGUMENTS, this.arguments, arguments);
this.arguments = assertNotNull(arguments);
setAsParentNodeOf(this.arguments);
return this;
}

public EnumConstantDeclaration setClassBody(NodeList<BodyDeclaration<?>> classBody) {
notifyPropertyChange(ObservableProperty.CLASS_BODY, this.classBody, classBody);
this.classBody = assertNotNull(classBody);
setAsParentNodeOf(this.classBody);
setAsParentNodeOf(this.classBody);
return this;
}

Expand All @@ -129,7 +129,7 @@ public EnumConstantDeclaration setName(SimpleName name) {

@Override
public JavadocComment getJavaDoc() {
if(getComment() instanceof JavadocComment){
if (getComment() instanceof JavadocComment) {
return (JavadocComment) getComment();
}
return null;
Expand All @@ -138,7 +138,7 @@ public JavadocComment getJavaDoc() {
@Override
public List<NodeList<?>> getNodeLists() {
List<NodeList<?>> res = new LinkedList<>(super.getNodeLists());
res.add(args);
res.add(arguments);
res.add(classBody);
return res;
}
Expand Down

0 comments on commit 69c6a76

Please sign in to comment.