Skip to content

Commit

Permalink
Correct Modifier usage, delete empty javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
nitsanw committed Nov 6, 2019
1 parent c209c08 commit 88ca9a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.ImportDeclaration;
import com.github.javaparser.ast.Modifier;
import com.github.javaparser.ast.Modifier.Keyword;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.ConstructorDeclaration;
Expand All @@ -31,7 +32,7 @@ public final class JavaParsingAtomicArrayQueueGenerator extends JavaParsingAtomi
public static void main(String[] args) throws Exception {
main(JavaParsingAtomicArrayQueueGenerator.class, args);
}

JavaParsingAtomicArrayQueueGenerator(String sourceFileName) {
super(sourceFileName);
}
Expand Down Expand Up @@ -125,9 +126,6 @@ void organiseImports(CompilationUnit cu) {
* Given a variable declaration of some sort, check it's name and type and
* if it looks like any of the key type changes between unsafe and atomic
* queues, perform the conversion to change it's type.
*
* @param node
* @param name
*/
void processSpecialNodeTypes(NodeWithType<?, Type> node, String name) {
Type type = node.getType();
Expand All @@ -151,8 +149,6 @@ void processSpecialNodeTypes(NodeWithType<?, Type> node, String name) {
* Searches all extended or implemented super classes or interfaces for
* special classes that differ with the atomics version and replaces them
* with the appropriate class.
*
* @param n
*/
private void replaceParentClassesForAtomics(ClassOrInterfaceDeclaration n) {
for (ClassOrInterfaceType parent : n.getExtendedTypes()) {
Expand All @@ -173,11 +169,6 @@ private void replaceParentClassesForAtomics(ClassOrInterfaceDeclaration n) {
* signature with code to redirect all calls to it to the
* <code>newMethodName</code>. Method signatures of both methods must match
* exactly.
*
* @param methodToPatch
* @param toMethodName
* @param returnType
* @param parameters
*/
private void patchMethodAsDeprecatedRedirector(MethodDeclaration methodToPatch, String toMethodName,
Type returnType, Parameter... parameters) {
Expand Down Expand Up @@ -206,15 +197,15 @@ private void patchMethodAsDeprecatedRedirector(MethodDeclaration methodToPatch,
* the field name are processed. Clearly <code>lv<code>, <code>lp<code> and
* <code>sv<code> are simple field accesses with only <code>so and <code>cas
* <code> using the AtomicFieldUpdaters.
*
*
* @param n
* the AST node for the containing class
*/
private void patchAtomicFieldUpdaterAccessorMethods(ClassOrInterfaceDeclaration n) {
String className = n.getNameAsString();

for (FieldDeclaration field : n.getFields()) {
if (field.getModifiers().contains(Keyword.STATIC)) {
if (field.getModifiers().contains(Modifier.staticModifier())) {
// Ignore statics
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void visit(ClassOrInterfaceDeclaration node, Void arg) {
@Override
public void visit(CastExpr n, Void arg) {
super.visit(n, arg);

if (isRefArray(n.getType(), "E")) {
n.setType(atomicRefArrayType((ArrayType) n.getType()));
}
Expand All @@ -114,11 +114,11 @@ String translateQueueName(String originalQueueName) {
if (originalQueueName.length() < 5) {
return originalQueueName;
}

if (originalQueueName.contains("LinkedQueue") || originalQueueName.contains("LinkedArrayQueue")) {
return originalQueueName.replace("Linked", "LinkedAtomic");
}

if (originalQueueName.contains("ArrayQueue")) {
return originalQueueName.replace("ArrayQueue", "AtomicArrayQueue");
}
Expand Down Expand Up @@ -153,11 +153,11 @@ void organiseImports(CompilationUnit cu) {
if (name.startsWith("org.jctools.queues.CircularArrayOffsetCalculator")) {
continue;
}

if (name.startsWith("org.jctools.queues.LinkedArrayQueueUtil")) {
importDeclaration.setName(name.replace("org.jctools.queues.LinkedArrayQueueUtil", "org.jctools.queues.atomic.LinkedAtomicArrayQueueUtil"));
}

importDecls.add(importDeclaration);
}
cu.getImports().clear();
Expand All @@ -180,9 +180,6 @@ void organiseImports(CompilationUnit cu) {
* Given a variable declaration of some sort, check it's name and type and
* if it looks like any of the key type changes between unsafe and atomic
* queues, perform the conversion to change it's type.
*
* @param node
* @param name
*/
void processSpecialNodeTypes(NodeWithType<?, Type> node, String name) {
Type type = node.getType();
Expand All @@ -207,8 +204,6 @@ void processSpecialNodeTypes(NodeWithType<?, Type> node, String name) {
* Searches all extended or implemented super classes or interfaces for
* special classes that differ with the atomics version and replaces them
* with the appropriate class.
*
* @param n
*/
private void replaceParentClassesForAtomics(ClassOrInterfaceDeclaration n) {
replaceParentClassesForAtomics(n.getExtendedTypes());
Expand All @@ -233,15 +228,14 @@ private void replaceParentClassesForAtomics(NodeList<ClassOrInterfaceType> types
* followed by the field name are processed. Clearly <code>lv<code>,
* <code>lp<code> and <code>sv<code> are simple field accesses with only
* <code>so and <code>cas <code> using the AtomicFieldUpdaters.
*
* @param n
* the AST node for the containing class
*
* @param n the AST node for the containing class
*/
private void patchAtomicFieldUpdaterAccessorMethods(ClassOrInterfaceDeclaration n) {
String className = n.getNameAsString();

for (FieldDeclaration field : n.getFields()) {
if (field.getModifiers().contains(Keyword.STATIC)) {
if (field.getModifiers().contains(Modifier.staticModifier())) {
// Ignore statics
continue;
}
Expand Down Expand Up @@ -312,7 +306,7 @@ private void patchAtomicFieldUpdaterAccessorMethods(ClassOrInterfaceDeclaration
/**
* Generates something like
* <code>return P_INDEX_UPDATER.getAndSet(this, newValue)</code>
*
*
* @param fieldUpdaterFieldName
* @param newValueName
* @return
Expand All @@ -327,7 +321,7 @@ private BlockStmt fieldUpdaterGetAndSet(String fieldUpdaterFieldName, String new
/**
* Generates something like
* <code>private static final AtomicReferenceFieldUpdater<MpmcAtomicArrayQueueProducerNodeField> P_NODE_UPDATER = AtomicReferenceFieldUpdater.newUpdater(MpmcAtomicArrayQueueProducerNodeField.class, "producerNode");</code>
*
*
* @param className
* @param variableName
* @return
Expand Down

0 comments on commit 88ca9a5

Please sign in to comment.