Search in sources :

Example 81 with NonNull

use of com.android.annotations.NonNull in project kotlin by JetBrains.

the class DomPsiParser method getLocation.

@NonNull
@Override
public Location getLocation(@NonNull XmlContext context, @NonNull Node node) {
    TextRange textRange = DomPsiConverter.getTextRange(node);
    Position start = new DefaultPosition(-1, -1, textRange.getStartOffset());
    Position end = new DefaultPosition(-1, -1, textRange.getEndOffset());
    return Location.create(context.file, start, end);
}
Also used : Position(com.android.tools.klint.detector.api.Position) DefaultPosition(com.android.tools.klint.detector.api.DefaultPosition) DefaultPosition(com.android.tools.klint.detector.api.DefaultPosition) TextRange(com.intellij.openapi.util.TextRange) NonNull(com.android.annotations.NonNull)

Example 82 with NonNull

use of com.android.annotations.NonNull in project kotlin by JetBrains.

the class DomPsiParser method getNameLocation.

@NonNull
@Override
public Location getNameLocation(@NonNull XmlContext context, @NonNull Node node) {
    TextRange textRange = DomPsiConverter.getTextNameRange(node);
    Position start = new DefaultPosition(-1, -1, textRange.getStartOffset());
    Position end = new DefaultPosition(-1, -1, textRange.getEndOffset());
    return Location.create(context.file, start, end);
}
Also used : Position(com.android.tools.klint.detector.api.Position) DefaultPosition(com.android.tools.klint.detector.api.DefaultPosition) DefaultPosition(com.android.tools.klint.detector.api.DefaultPosition) TextRange(com.intellij.openapi.util.TextRange) NonNull(com.android.annotations.NonNull)

Example 83 with NonNull

use of com.android.annotations.NonNull in project kotlin by JetBrains.

the class Project method getJavaClassFolders.

/**
     * Returns the list of output folders for class files
     * @return a list of output folders to search for .class files
     */
@NonNull
public List<File> getJavaClassFolders() {
    if (mJavaClassFolders == null) {
        if (isAospFrameworksProject(mDir)) {
            String top = getAospTop();
            if (top != null) {
                //$NON-NLS-1$
                File out = new File(top, "out");
                if (out.exists()) {
                    String relative = "target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar";
                    File jar = new File(out, relative.replace('/', File.separatorChar));
                    if (jar.exists()) {
                        mJavaClassFolders = Collections.singletonList(jar);
                        return mJavaClassFolders;
                    }
                }
            }
        }
        if (isAospBuildEnvironment()) {
            String top = getAospTop();
            if (mDir.getAbsolutePath().startsWith(top)) {
                mJavaClassFolders = getAospJavaClassPath();
                return mJavaClassFolders;
            }
        }
        mJavaClassFolders = mClient.getJavaClassFolders(this);
    }
    return mJavaClassFolders;
}
Also used : OutputFile(com.android.build.OutputFile) File(java.io.File) NonNull(com.android.annotations.NonNull)

Example 84 with NonNull

use of com.android.annotations.NonNull in project kotlin by JetBrains.

the class ControlFlowGraph method toString.

/**
     * Creates a human readable version of the graph
     *
     * @param start the starting instruction, or null if not known or to use the
     *            first instruction
     * @return a string version of the graph
     */
@NonNull
public String toString(@Nullable Node start) {
    StringBuilder sb = new StringBuilder(400);
    AbstractInsnNode curr;
    if (start != null) {
        curr = start.instruction;
    } else {
        if (mNodeMap.isEmpty()) {
            return "<empty>";
        } else {
            curr = mNodeMap.keySet().iterator().next();
            while (curr.getPrevious() != null) {
                curr = curr.getPrevious();
            }
        }
    }
    while (curr != null) {
        Node node = mNodeMap.get(curr);
        if (node != null) {
            sb.append(node.toString(true));
        }
        curr = curr.getNext();
    }
    return sb.toString();
}
Also used : FieldInsnNode(org.jetbrains.org.objectweb.asm.tree.FieldInsnNode) FrameNode(org.jetbrains.org.objectweb.asm.tree.FrameNode) JumpInsnNode(org.jetbrains.org.objectweb.asm.tree.JumpInsnNode) MethodInsnNode(org.jetbrains.org.objectweb.asm.tree.MethodInsnNode) TryCatchBlockNode(org.jetbrains.org.objectweb.asm.tree.TryCatchBlockNode) AbstractInsnNode(org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode) LineNumberNode(org.jetbrains.org.objectweb.asm.tree.LineNumberNode) TypeInsnNode(org.jetbrains.org.objectweb.asm.tree.TypeInsnNode) ClassNode(org.jetbrains.org.objectweb.asm.tree.ClassNode) IntInsnNode(org.jetbrains.org.objectweb.asm.tree.IntInsnNode) LabelNode(org.jetbrains.org.objectweb.asm.tree.LabelNode) LdcInsnNode(org.jetbrains.org.objectweb.asm.tree.LdcInsnNode) MethodNode(org.jetbrains.org.objectweb.asm.tree.MethodNode) AbstractInsnNode(org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode) NonNull(com.android.annotations.NonNull)

Example 85 with NonNull

use of com.android.annotations.NonNull in project kotlin by JetBrains.

the class ControlFlowGraph method getNode.

/**
     * Looks up (and if necessary) creates a graph node for the given instruction
     *
     * @param instruction the instruction
     * @return the control flow graph node corresponding to the given
     *         instruction
     */
@NonNull
public Node getNode(@NonNull AbstractInsnNode instruction) {
    Node node = mNodeMap.get(instruction);
    if (node == null) {
        node = new Node(instruction);
        mNodeMap.put(instruction, node);
    }
    return node;
}
Also used : FieldInsnNode(org.jetbrains.org.objectweb.asm.tree.FieldInsnNode) FrameNode(org.jetbrains.org.objectweb.asm.tree.FrameNode) JumpInsnNode(org.jetbrains.org.objectweb.asm.tree.JumpInsnNode) MethodInsnNode(org.jetbrains.org.objectweb.asm.tree.MethodInsnNode) TryCatchBlockNode(org.jetbrains.org.objectweb.asm.tree.TryCatchBlockNode) AbstractInsnNode(org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode) LineNumberNode(org.jetbrains.org.objectweb.asm.tree.LineNumberNode) TypeInsnNode(org.jetbrains.org.objectweb.asm.tree.TypeInsnNode) ClassNode(org.jetbrains.org.objectweb.asm.tree.ClassNode) IntInsnNode(org.jetbrains.org.objectweb.asm.tree.IntInsnNode) LabelNode(org.jetbrains.org.objectweb.asm.tree.LabelNode) LdcInsnNode(org.jetbrains.org.objectweb.asm.tree.LdcInsnNode) MethodNode(org.jetbrains.org.objectweb.asm.tree.MethodNode) NonNull(com.android.annotations.NonNull)

Aggregations

NonNull (com.android.annotations.NonNull)89 File (java.io.File)23 TextRange (com.intellij.openapi.util.TextRange)13 IOException (java.io.IOException)11 ArrayList (java.util.ArrayList)8 OutputFile (com.android.build.OutputFile)5 DefaultPosition (com.android.tools.klint.detector.api.DefaultPosition)5 Position (com.android.tools.klint.detector.api.Position)5 Issue (com.android.tools.klint.detector.api.Issue)4 Position (com.android.tools.lint.detector.api.Position)4 Module (com.intellij.openapi.module.Module)4 StringReader (java.io.StringReader)4 AbstractInsnNode (org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode)4 Node (org.w3c.dom.Node)4 NodeList (org.w3c.dom.NodeList)4 InputSource (org.xml.sax.InputSource)4 Nullable (com.android.annotations.Nullable)3 AaptPackageProcessBuilder (com.android.builder.core.AaptPackageProcessBuilder)3 AtlasBuilder (com.android.builder.core.AtlasBuilder)3 AndroidProject (com.android.builder.model.AndroidProject)3