Class JavaParsingAtomicArrayQueueGenerator

  • All Implemented Interfaces:
    com.github.javaparser.ast.visitor.VoidVisitor<java.lang.Void>

    public final class JavaParsingAtomicArrayQueueGenerator
    extends JavaParsingAtomicQueueGenerator
    • Field Detail

      • GEN_DIRECTIVE_CLASS_CONTAINS_ORDERED_FIELD_ACCESSORS

        private static final java.lang.String GEN_DIRECTIVE_CLASS_CONTAINS_ORDERED_FIELD_ACCESSORS
        See Also:
        Constant Field Values
      • GEN_DIRECTIVE_METHOD_IGNORE

        private static final java.lang.String GEN_DIRECTIVE_METHOD_IGNORE
        See Also:
        Constant Field Values
    • Constructor Detail

      • JavaParsingAtomicArrayQueueGenerator

        JavaParsingAtomicArrayQueueGenerator​(java.lang.String sourceFileName)
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • visit

        public void visit​(com.github.javaparser.ast.body.ConstructorDeclaration n,
                          java.lang.Void arg)
        Specified by:
        visit in interface com.github.javaparser.ast.visitor.VoidVisitor<java.lang.Void>
        Overrides:
        visit in class com.github.javaparser.ast.visitor.VoidVisitorAdapter<java.lang.Void>
      • visit

        public void visit​(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration node,
                          java.lang.Void arg)
        Specified by:
        visit in interface com.github.javaparser.ast.visitor.VoidVisitor<java.lang.Void>
        Overrides:
        visit in class com.github.javaparser.ast.visitor.VoidVisitorAdapter<java.lang.Void>
      • processSpecialNodeTypes

        void processSpecialNodeTypes​(com.github.javaparser.ast.nodeTypes.NodeWithType<?,​com.github.javaparser.ast.type.Type> node,
                                     java.lang.String name)
        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.
        Specified by:
        processSpecialNodeTypes in class JavaParsingAtomicQueueGenerator
      • replaceParentClassesForAtomics

        private void replaceParentClassesForAtomics​(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration n)
        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.
      • patchMethodAsDeprecatedRedirector

        private void patchMethodAsDeprecatedRedirector​(com.github.javaparser.ast.body.MethodDeclaration methodToPatch,
                                                       java.lang.String toMethodName,
                                                       com.github.javaparser.ast.type.Type returnType,
                                                       com.github.javaparser.ast.body.Parameter... parameters)
        Given a method declaration node this method will replace it's code and signature with code to redirect all calls to it to the newMethodName. Method signatures of both methods must match exactly.
      • patchAtomicFieldUpdaterAccessorMethods

        private void patchAtomicFieldUpdaterAccessorMethods​(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration n)
        For each method accessor to a field, add in the calls necessary to AtomicFieldUpdaters. Only methods start with so/cas/sv/lv/lp followed by the field name are processed. Clearly lv, lp and sv are simple field accesses with only so and cas using the AtomicFieldUpdaters.
        Parameters:
        n - the AST node for the containing class
      • isLongArray

        private boolean isLongArray​(com.github.javaparser.ast.type.Type in)
      • atomicRefArrayType

        private com.github.javaparser.ast.type.ClassOrInterfaceType atomicRefArrayType​(com.github.javaparser.ast.type.ArrayType in)
      • atomicLongArrayType

        private com.github.javaparser.ast.type.ClassOrInterfaceType atomicLongArrayType()