Introducing Extra Jackpot 3.0 UI separate-by-function-cleanup
authorJan Lahoda <jlahoda@netbeans.org>
Sat, 18 Feb 2012 22:14:42 +0100
branchseparate-by-function-cleanup
changeset 736c23c0b31bd6b
parent 735 9769c807a9d6
child 737 9897b9a18934
Introducing Extra Jackpot 3.0 UI
api/src/org/netbeans/modules/jackpot30/impl/refactoring/findusages/PatternGenerator.java
api/test/unit/src/org/netbeans/modules/jackpot30/impl/refactoring/findusages/PatternGeneratorTest.java
language/ide/nbproject/project.properties
language/ide/ui/build.xml
language/ide/ui/manifest.mf
language/ide/ui/nbproject/build-impl.xml
language/ide/ui/nbproject/genfiles.properties
language/ide/ui/nbproject/project.properties
language/ide/ui/nbproject/project.xml
language/ide/ui/nbproject/suite.properties
language/ide/ui/src/org/netbeans/modules/jackpot30/ui/Bundle.properties
language/ide/ui/src/org/netbeans/modules/jackpot30/ui/GenerateJackpotScript.java
language/ide/ui/src/org/netbeans/modules/jackpot30/ui/PatternGenerator.java
language/ide/ui/src/org/netbeans/modules/jackpot30/ui/layer.xml
language/ide/ui/test/unit/src/org/netbeans/modules/jackpot30/ui/PatternGeneratorTest.java
     1.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/findusages/PatternGenerator.java	Sat Feb 18 22:14:03 2012 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,146 +0,0 @@
     1.4 -/*
     1.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     1.6 - *
     1.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
     1.8 - *
     1.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    1.10 - * Other names may be trademarks of their respective owners.
    1.11 - *
    1.12 - * The contents of this file are subject to the terms of either the GNU
    1.13 - * General Public License Version 2 only ("GPL") or the Common
    1.14 - * Development and Distribution License("CDDL") (collectively, the
    1.15 - * "License"). You may not use this file except in compliance with the
    1.16 - * License. You can obtain a copy of the License at
    1.17 - * http://www.netbeans.org/cddl-gplv2.html
    1.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    1.19 - * specific language governing permissions and limitations under the
    1.20 - * License.  When distributing the software, include this License Header
    1.21 - * Notice in each file and include the License file at
    1.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    1.23 - * particular file as subject to the "Classpath" exception as provided
    1.24 - * by Oracle in the GPL Version 2 section of the License file that
    1.25 - * accompanied this code. If applicable, add the following below the
    1.26 - * License Header, with the fields enclosed by brackets [] replaced by
    1.27 - * your own identifying information:
    1.28 - * "Portions Copyrighted [year] [name of copyright owner]"
    1.29 - *
    1.30 - * If you wish your version of this file to be governed by only the CDDL
    1.31 - * or only the GPL Version 2, indicate your decision by adding
    1.32 - * "[Contributor] elects to include this software in this distribution
    1.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    1.34 - * single choice of license, a recipient has the option to distribute
    1.35 - * your version of this file under either the CDDL, the GPL Version 2 or
    1.36 - * to extend the choice of license to its licensees as provided above.
    1.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    1.38 - * Version 2 license, then the option applies only if the new code is
    1.39 - * made subject to such option by the copyright holder.
    1.40 - *
    1.41 - * Contributor(s):
    1.42 - *
    1.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
    1.44 - */
    1.45 -
    1.46 -package org.netbeans.modules.jackpot30.impl.refactoring.findusages;
    1.47 -
    1.48 -import javax.lang.model.element.Element;
    1.49 -import javax.lang.model.element.ExecutableElement;
    1.50 -import javax.lang.model.element.Modifier;
    1.51 -import javax.lang.model.element.TypeElement;
    1.52 -import javax.lang.model.element.VariableElement;
    1.53 -import org.netbeans.api.annotations.common.CheckForNull;
    1.54 -import org.netbeans.api.annotations.common.NonNull;
    1.55 -import org.netbeans.api.java.source.CompilationInfo;
    1.56 -
    1.57 -/**
    1.58 - *
    1.59 - * @author lahvac
    1.60 - */
    1.61 -public class PatternGenerator {
    1.62 -
    1.63 -    public static @CheckForNull String generateFindUsagesScript(CompilationInfo info, Element usagesOf) {
    1.64 -        switch (usagesOf.getKind()) {
    1.65 -            case METHOD: return generateMethodFindUsagesScript(info, (ExecutableElement) usagesOf);
    1.66 -            case ENUM_CONSTANT:
    1.67 -            case FIELD: return generateFieldFindUsagesScript(info, (VariableElement) usagesOf);
    1.68 -            case ANNOTATION_TYPE:
    1.69 -            case CLASS:
    1.70 -            case ENUM:
    1.71 -            case INTERFACE: return generateClassFindUsagesScript(info, (TypeElement) usagesOf);
    1.72 -            default: return null;
    1.73 -        }
    1.74 -    }
    1.75 -
    1.76 -    private static @NonNull String generateMethodFindUsagesScript(CompilationInfo info, ExecutableElement usagesOf) {
    1.77 -        StringBuilder script = new StringBuilder();
    1.78 -        StringBuilder parameters = new StringBuilder();
    1.79 -        StringBuilder constraints = new StringBuilder();
    1.80 -        String enclosingType = info.getTypes().erasure(usagesOf.getEnclosingElement().asType()).toString();
    1.81 -        int count = 1;
    1.82 -
    1.83 -        if (usagesOf.getModifiers().contains(Modifier.STATIC)) {
    1.84 -            script.append(enclosingType);
    1.85 -        } else {
    1.86 -            script.append("$this");
    1.87 -            constraints.append("$this instanceof ").append(enclosingType);
    1.88 -        }
    1.89 -
    1.90 -        script.append(".").append(usagesOf.getSimpleName()).append("(");
    1.91 -
    1.92 -        for (VariableElement p : usagesOf.getParameters()) {
    1.93 -            if (count > 1) {
    1.94 -                parameters.append(", ");
    1.95 -            }
    1.96 -
    1.97 -            if (constraints.length() > 0) {
    1.98 -                constraints.append(" && ");
    1.99 -            }
   1.100 -            parameters.append("$").append(count);
   1.101 -            constraints.append("$").append(count).append(" instanceof ").append(info.getTypes().erasure(p.asType()));
   1.102 -            count++;
   1.103 -        }
   1.104 -
   1.105 -        script.append(parameters).append(")");
   1.106 -
   1.107 -        if (constraints.length() > 0) {
   1.108 -            script.append(" :: ").append(constraints);
   1.109 -        }
   1.110 -
   1.111 -        script.append(";;");
   1.112 -
   1.113 -        return script.toString();
   1.114 -    }
   1.115 -
   1.116 -    private static @NonNull String generateFieldFindUsagesScript(CompilationInfo info, VariableElement usagesOf) {
   1.117 -        StringBuilder script = new StringBuilder();
   1.118 -        StringBuilder constraints = new StringBuilder();
   1.119 -        String enclosingType = info.getTypes().erasure(usagesOf.getEnclosingElement().asType()).toString();
   1.120 -        int count = 1;
   1.121 -
   1.122 -        if (usagesOf.getModifiers().contains(Modifier.STATIC)) {
   1.123 -            script.append(enclosingType);
   1.124 -        } else {
   1.125 -            script.append("$this");
   1.126 -            constraints.append("$this instanceof ").append(enclosingType);
   1.127 -        }
   1.128 -
   1.129 -        script.append(".").append(usagesOf.getSimpleName());
   1.130 -
   1.131 -        if (constraints.length() > 0) {
   1.132 -            script.append(" :: ").append(constraints);
   1.133 -        }
   1.134 -
   1.135 -        script.append(";;");
   1.136 -
   1.137 -        return script.toString();
   1.138 -    }
   1.139 -
   1.140 -    private static @NonNull String generateClassFindUsagesScript(CompilationInfo info, TypeElement usagesOf) {
   1.141 -        StringBuilder script = new StringBuilder();
   1.142 -
   1.143 -        script.append(usagesOf.getQualifiedName());
   1.144 -        script.append(";;");
   1.145 -
   1.146 -        return script.toString();
   1.147 -    }
   1.148 -
   1.149 -}
     2.1 --- a/api/test/unit/src/org/netbeans/modules/jackpot30/impl/refactoring/findusages/PatternGeneratorTest.java	Sat Feb 18 22:14:03 2012 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,134 +0,0 @@
     2.4 -/*
     2.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     2.6 - *
     2.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
     2.8 - *
     2.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    2.10 - * Other names may be trademarks of their respective owners.
    2.11 - *
    2.12 - * The contents of this file are subject to the terms of either the GNU
    2.13 - * General Public License Version 2 only ("GPL") or the Common
    2.14 - * Development and Distribution License("CDDL") (collectively, the
    2.15 - * "License"). You may not use this file except in compliance with the
    2.16 - * License. You can obtain a copy of the License at
    2.17 - * http://www.netbeans.org/cddl-gplv2.html
    2.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    2.19 - * specific language governing permissions and limitations under the
    2.20 - * License.  When distributing the software, include this License Header
    2.21 - * Notice in each file and include the License file at
    2.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    2.23 - * particular file as subject to the "Classpath" exception as provided
    2.24 - * by Oracle in the GPL Version 2 section of the License file that
    2.25 - * accompanied this code. If applicable, add the following below the
    2.26 - * License Header, with the fields enclosed by brackets [] replaced by
    2.27 - * your own identifying information:
    2.28 - * "Portions Copyrighted [year] [name of copyright owner]"
    2.29 - *
    2.30 - * If you wish your version of this file to be governed by only the CDDL
    2.31 - * or only the GPL Version 2, indicate your decision by adding
    2.32 - * "[Contributor] elects to include this software in this distribution
    2.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    2.34 - * single choice of license, a recipient has the option to distribute
    2.35 - * your version of this file under either the CDDL, the GPL Version 2 or
    2.36 - * to extend the choice of license to its licensees as provided above.
    2.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    2.38 - * Version 2 license, then the option applies only if the new code is
    2.39 - * made subject to such option by the copyright holder.
    2.40 - *
    2.41 - * Contributor(s):
    2.42 - *
    2.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
    2.44 - */
    2.45 -
    2.46 -package org.netbeans.modules.jackpot30.impl.refactoring.findusages;
    2.47 -
    2.48 -import com.sun.source.util.TreePath;
    2.49 -import java.util.List;
    2.50 -import java.util.concurrent.atomic.AtomicBoolean;
    2.51 -import org.netbeans.api.java.source.CompilationInfo;
    2.52 -import org.netbeans.modules.java.hints.infrastructure.TreeRuleTestBase;
    2.53 -import org.netbeans.modules.java.hints.jackpot.impl.hints.HintsInvoker;
    2.54 -import org.netbeans.modules.java.hints.jackpot.spi.PatternConvertor;
    2.55 -import org.netbeans.spi.editor.hints.ErrorDescription;
    2.56 -
    2.57 -/**
    2.58 - *
    2.59 - * @author lahvac
    2.60 - */
    2.61 -public class PatternGeneratorTest extends TreeRuleTestBase {
    2.62 -
    2.63 -    public PatternGeneratorTest(String name) {
    2.64 -        super(name);
    2.65 -    }
    2.66 -
    2.67 -    public void testStaticMethod() throws Exception {
    2.68 -        performTest("package test;\n" +
    2.69 -                    "public class Test {\n" +
    2.70 -                    "    public static void te|st(int i, String s) {\n" +
    2.71 -                    "        test(i, s);\n" +
    2.72 -                    "    }\n" +
    2.73 -                    "}\n",
    2.74 -                    "3:8-3:12:verifier:TODO: No display name");
    2.75 -    }
    2.76 -
    2.77 -    public void testInstanceMethod() throws Exception {
    2.78 -        performTest("package test;\n" +
    2.79 -                    "public class Test {\n" +
    2.80 -                    "    public void te|st(int i, String s) {\n" +
    2.81 -                    "        new Test().test(i, s);\n" +
    2.82 -                    "        test(i, s);\n" +
    2.83 -                    "    }\n" +
    2.84 -                    "}\n",
    2.85 -                    "3:19-3:23:verifier:TODO: No display name",
    2.86 -                    "4:8-4:12:verifier:TODO: No display name");
    2.87 -    }
    2.88 -
    2.89 -    public void testStaticField() throws Exception {
    2.90 -        performTest("package test;\n" +
    2.91 -                    "public class Test {\n" +
    2.92 -                    "    public static int I|I = 0;" +
    2.93 -                    "    public int test() {\n" +
    2.94 -                    "        return II;\n" +
    2.95 -                    "    }\n" +
    2.96 -                    "}\n",
    2.97 -                    "3:15-3:17:verifier:TODO: No display name");
    2.98 -    }
    2.99 -
   2.100 -    public void testInstanceField() throws Exception {
   2.101 -        performTest("package test;\n" +
   2.102 -                    "public class Test {\n" +
   2.103 -                    "    public int I|I = 0;" +
   2.104 -                    "    public int test() {\n" +
   2.105 -                    "        if (true) return II; else return new Test().II;\n" +
   2.106 -                    "    }\n" +
   2.107 -                    "}\n",
   2.108 -                    "3:25-3:27:verifier:TODO: No display name",
   2.109 -                    "3:52-3:54:verifier:TODO: No display name");
   2.110 -    }
   2.111 -
   2.112 -    private void performTest(String code, String... golden) throws Exception {
   2.113 -        performAnalysisTest("test/Test.java",
   2.114 -                            code,
   2.115 -                            golden);
   2.116 -    }
   2.117 -
   2.118 -    @Override
   2.119 -    protected List<ErrorDescription> computeErrors(CompilationInfo info, TreePath path) {
   2.120 -        String script = PatternGenerator.generateFindUsagesScript(info, info.getTrees().getElement(path));
   2.121 -
   2.122 -        return new HintsInvoker(info, new AtomicBoolean()).computeHints(info, PatternConvertor.create(script));
   2.123 -    }
   2.124 -
   2.125 -    @Override
   2.126 -    public void testIssue105979() throws Exception {}
   2.127 -
   2.128 -    @Override
   2.129 -    public void testIssue108246() throws Exception {}
   2.130 -
   2.131 -    @Override
   2.132 -    public void testIssue113933() throws Exception {}
   2.133 -
   2.134 -    @Override
   2.135 -    public void testNoHintsForSimpleInitialize() throws Exception {}
   2.136 -
   2.137 -}
     3.1 --- a/language/ide/nbproject/project.properties	Sat Feb 18 22:14:03 2012 +0100
     3.2 +++ b/language/ide/nbproject/project.properties	Sat Feb 18 22:14:42 2012 +0100
     3.3 @@ -1,3 +1,5 @@
     3.4  modules=\
     3.5 -    ${project.org.netbeans.modules.jackpot30.indexing}
     3.6 +    ${project.org.netbeans.modules.jackpot30.indexing}:\
     3.7 +    ${project.org.netbeans.modules.jackpot30.ui}
     3.8  project.org.netbeans.modules.jackpot30.indexing=indexing
     3.9 +project.org.netbeans.modules.jackpot30.ui=ui
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/language/ide/ui/build.xml	Sat Feb 18 22:14:42 2012 +0100
     4.3 @@ -0,0 +1,8 @@
     4.4 +<?xml version="1.0" encoding="UTF-8"?>
     4.5 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
     4.6 +<!-- for some information on what you could do (e.g. targets to override). -->
     4.7 +<!-- If you delete this file and reopen the project it will be recreated. -->
     4.8 +<project name="org.netbeans.modules.jackpot30.ui" default="netbeans" basedir=".">
     4.9 +    <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.ui.</description>
    4.10 +    <import file="nbproject/build-impl.xml"/>
    4.11 +</project>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/language/ide/ui/manifest.mf	Sat Feb 18 22:14:42 2012 +0100
     5.3 @@ -0,0 +1,6 @@
     5.4 +Manifest-Version: 1.0
     5.5 +OpenIDE-Module: org.netbeans.modules.jackpot30.ui
     5.6 +OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/ui/layer.xml
     5.7 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/ui/Bundle.properties
     5.8 +OpenIDE-Module-Specification-Version: 1.0
     5.9 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/language/ide/ui/nbproject/build-impl.xml	Sat Feb 18 22:14:42 2012 +0100
     6.3 @@ -0,0 +1,45 @@
     6.4 +<?xml version="1.0" encoding="UTF-8"?>
     6.5 +<!--
     6.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
     6.7 +***         EDIT ../build.xml INSTEAD         ***
     6.8 +-->
     6.9 +<project name="org.netbeans.modules.jackpot30.ui-impl" basedir="..">
    6.10 +    <fail message="Please build using Ant 1.7.1 or higher.">
    6.11 +        <condition>
    6.12 +            <not>
    6.13 +                <antversion atleast="1.7.1"/>
    6.14 +            </not>
    6.15 +        </condition>
    6.16 +    </fail>
    6.17 +    <property file="nbproject/private/suite-private.properties"/>
    6.18 +    <property file="nbproject/suite.properties"/>
    6.19 +    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
    6.20 +    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
    6.21 +    <property file="${suite.dir}/nbproject/platform.properties"/>
    6.22 +    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
    6.23 +        <attribute name="name"/>
    6.24 +        <attribute name="value"/>
    6.25 +        <sequential>
    6.26 +            <property name="@{name}" value="${@{value}}"/>
    6.27 +        </sequential>
    6.28 +    </macrodef>
    6.29 +    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
    6.30 +        <attribute name="property"/>
    6.31 +        <attribute name="value"/>
    6.32 +        <sequential>
    6.33 +            <property name="@{property}" value="@{value}"/>
    6.34 +        </sequential>
    6.35 +    </macrodef>
    6.36 +    <property file="${user.properties.file}"/>
    6.37 +    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
    6.38 +    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
    6.39 +    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
    6.40 +    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
    6.41 +        <condition>
    6.42 +            <not>
    6.43 +                <contains string="${cluster.path.evaluated}" substring="platform"/>
    6.44 +            </not>
    6.45 +        </condition>
    6.46 +    </fail>
    6.47 +    <import file="${harness.dir}/build.xml"/>
    6.48 +</project>
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/language/ide/ui/nbproject/genfiles.properties	Sat Feb 18 22:14:42 2012 +0100
     7.3 @@ -0,0 +1,8 @@
     7.4 +build.xml.data.CRC32=6a9d4938
     7.5 +build.xml.script.CRC32=4ac38acd
     7.6 +build.xml.stylesheet.CRC32=a56c6a5b@2.49
     7.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     7.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
     7.9 +nbproject/build-impl.xml.data.CRC32=6a9d4938
    7.10 +nbproject/build-impl.xml.script.CRC32=e59dabeb
    7.11 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.49
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/language/ide/ui/nbproject/project.properties	Sat Feb 18 22:14:42 2012 +0100
     8.3 @@ -0,0 +1,2 @@
     8.4 +javac.source=1.6
     8.5 +javac.compilerargs=-Xlint -Xlint:-serial
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/language/ide/ui/nbproject/project.xml	Sat Feb 18 22:14:42 2012 +0100
     9.3 @@ -0,0 +1,147 @@
     9.4 +<?xml version="1.0" encoding="UTF-8"?>
     9.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
     9.6 +    <type>org.netbeans.modules.apisupport.project</type>
     9.7 +    <configuration>
     9.8 +        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
     9.9 +            <code-name-base>org.netbeans.modules.jackpot30.ui</code-name-base>
    9.10 +            <suite-component/>
    9.11 +            <module-dependencies>
    9.12 +                <dependency>
    9.13 +                    <code-name-base>org.netbeans.api.annotations.common</code-name-base>
    9.14 +                    <build-prerequisite/>
    9.15 +                    <compile-dependency/>
    9.16 +                    <run-dependency>
    9.17 +                        <release-version>1</release-version>
    9.18 +                        <specification-version>1.13</specification-version>
    9.19 +                    </run-dependency>
    9.20 +                </dependency>
    9.21 +                <dependency>
    9.22 +                    <code-name-base>org.netbeans.libs.javacapi</code-name-base>
    9.23 +                    <build-prerequisite/>
    9.24 +                    <compile-dependency/>
    9.25 +                    <run-dependency>
    9.26 +                        <specification-version>7.9.0.3</specification-version>
    9.27 +                    </run-dependency>
    9.28 +                </dependency>
    9.29 +                <dependency>
    9.30 +                    <code-name-base>org.netbeans.modules.editor</code-name-base>
    9.31 +                    <build-prerequisite/>
    9.32 +                    <compile-dependency/>
    9.33 +                    <run-dependency>
    9.34 +                        <release-version>3</release-version>
    9.35 +                        <specification-version>1.60.0.5.19.25</specification-version>
    9.36 +                    </run-dependency>
    9.37 +                </dependency>
    9.38 +                <dependency>
    9.39 +                    <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
    9.40 +                    <build-prerequisite/>
    9.41 +                    <compile-dependency/>
    9.42 +                    <run-dependency>
    9.43 +                        <release-version>3</release-version>
    9.44 +                        <specification-version>3.19.0.19.25</specification-version>
    9.45 +                    </run-dependency>
    9.46 +                </dependency>
    9.47 +                <dependency>
    9.48 +                    <code-name-base>org.netbeans.modules.editor.lib2</code-name-base>
    9.49 +                    <build-prerequisite/>
    9.50 +                    <compile-dependency/>
    9.51 +                    <run-dependency>
    9.52 +                        <release-version>1</release-version>
    9.53 +                        <specification-version>1.54.0.25</specification-version>
    9.54 +                    </run-dependency>
    9.55 +                </dependency>
    9.56 +                <dependency>
    9.57 +                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
    9.58 +                    <build-prerequisite/>
    9.59 +                    <compile-dependency/>
    9.60 +                    <run-dependency>
    9.61 +                        <specification-version>0.95.0.19.18.6</specification-version>
    9.62 +                    </run-dependency>
    9.63 +                </dependency>
    9.64 +                <dependency>
    9.65 +                    <code-name-base>org.openide.awt</code-name-base>
    9.66 +                    <build-prerequisite/>
    9.67 +                    <compile-dependency/>
    9.68 +                    <run-dependency>
    9.69 +                        <specification-version>7.42</specification-version>
    9.70 +                    </run-dependency>
    9.71 +                </dependency>
    9.72 +                <dependency>
    9.73 +                    <code-name-base>org.openide.filesystems</code-name-base>
    9.74 +                    <build-prerequisite/>
    9.75 +                    <compile-dependency/>
    9.76 +                    <run-dependency>
    9.77 +                        <specification-version>7.59</specification-version>
    9.78 +                    </run-dependency>
    9.79 +                </dependency>
    9.80 +                <dependency>
    9.81 +                    <code-name-base>org.openide.loaders</code-name-base>
    9.82 +                    <build-prerequisite/>
    9.83 +                    <compile-dependency/>
    9.84 +                    <run-dependency>
    9.85 +                        <specification-version>7.36</specification-version>
    9.86 +                    </run-dependency>
    9.87 +                </dependency>
    9.88 +                <dependency>
    9.89 +                    <code-name-base>org.openide.nodes</code-name-base>
    9.90 +                    <build-prerequisite/>
    9.91 +                    <compile-dependency/>
    9.92 +                    <run-dependency>
    9.93 +                        <specification-version>7.27</specification-version>
    9.94 +                    </run-dependency>
    9.95 +                </dependency>
    9.96 +                <dependency>
    9.97 +                    <code-name-base>org.openide.util</code-name-base>
    9.98 +                    <build-prerequisite/>
    9.99 +                    <compile-dependency/>
   9.100 +                    <run-dependency>
   9.101 +                        <specification-version>8.22</specification-version>
   9.102 +                    </run-dependency>
   9.103 +                </dependency>
   9.104 +                <dependency>
   9.105 +                    <code-name-base>org.openide.util.lookup</code-name-base>
   9.106 +                    <build-prerequisite/>
   9.107 +                    <compile-dependency/>
   9.108 +                    <run-dependency>
   9.109 +                        <specification-version>8.12</specification-version>
   9.110 +                    </run-dependency>
   9.111 +                </dependency>
   9.112 +            </module-dependencies>
   9.113 +            <test-dependencies>
   9.114 +                <test-type>
   9.115 +                    <name>unit</name>
   9.116 +                    <test-dependency>
   9.117 +                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
   9.118 +                        <compile-dependency/>
   9.119 +                    </test-dependency>
   9.120 +                    <test-dependency>
   9.121 +                        <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
   9.122 +                        <compile-dependency/>
   9.123 +                    </test-dependency>
   9.124 +                    <test-dependency>
   9.125 +                        <code-name-base>org.netbeans.modules.java.editor</code-name-base>
   9.126 +                        <compile-dependency/>
   9.127 +                    </test-dependency>
   9.128 +                    <test-dependency>
   9.129 +                        <code-name-base>org.netbeans.modules.java.hints</code-name-base>
   9.130 +                        <compile-dependency/>
   9.131 +                    </test-dependency>
   9.132 +                    <test-dependency>
   9.133 +                        <code-name-base>org.netbeans.modules.java.hints.declarative</code-name-base>
   9.134 +                        <compile-dependency/>
   9.135 +                    </test-dependency>
   9.136 +                    <test-dependency>
   9.137 +                        <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
   9.138 +                        <recursive/>
   9.139 +                        <compile-dependency/>
   9.140 +                    </test-dependency>
   9.141 +                    <test-dependency>
   9.142 +                        <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
   9.143 +                        <compile-dependency/>
   9.144 +                    </test-dependency>
   9.145 +                </test-type>
   9.146 +            </test-dependencies>
   9.147 +            <public-packages/>
   9.148 +        </data>
   9.149 +    </configuration>
   9.150 +</project>
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/language/ide/ui/nbproject/suite.properties	Sat Feb 18 22:14:42 2012 +0100
    10.3 @@ -0,0 +1,1 @@
    10.4 +suite.dir=${basedir}/..
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/Bundle.properties	Sat Feb 18 22:14:42 2012 +0100
    11.3 @@ -0,0 +1,1 @@
    11.4 +OpenIDE-Module-Name=Jackpot 3.0 Extra UI
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/GenerateJackpotScript.java	Sat Feb 18 22:14:42 2012 +0100
    12.3 @@ -0,0 +1,112 @@
    12.4 +/*
    12.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    12.6 + *
    12.7 + * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
    12.8 + *
    12.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   12.10 + * Other names may be trademarks of their respective owners.
   12.11 + *
   12.12 + * The contents of this file are subject to the terms of either the GNU
   12.13 + * General Public License Version 2 only ("GPL") or the Common
   12.14 + * Development and Distribution License("CDDL") (collectively, the
   12.15 + * "License"). You may not use this file except in compliance with the
   12.16 + * License. You can obtain a copy of the License at
   12.17 + * http://www.netbeans.org/cddl-gplv2.html
   12.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   12.19 + * specific language governing permissions and limitations under the
   12.20 + * License.  When distributing the software, include this License Header
   12.21 + * Notice in each file and include the License file at
   12.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   12.23 + * particular file as subject to the "Classpath" exception as provided
   12.24 + * by Oracle in the GPL Version 2 section of the License file that
   12.25 + * accompanied this code. If applicable, add the following below the
   12.26 + * License Header, with the fields enclosed by brackets [] replaced by
   12.27 + * your own identifying information:
   12.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   12.29 + *
   12.30 + * If you wish your version of this file to be governed by only the CDDL
   12.31 + * or only the GPL Version 2, indicate your decision by adding
   12.32 + * "[Contributor] elects to include this software in this distribution
   12.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   12.34 + * single choice of license, a recipient has the option to distribute
   12.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   12.36 + * to extend the choice of license to its licensees as provided above.
   12.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   12.38 + * Version 2 license, then the option applies only if the new code is
   12.39 + * made subject to such option by the copyright holder.
   12.40 + *
   12.41 + * Contributor(s):
   12.42 + *
   12.43 + * Portions Copyrighted 2012 Sun Microsystems, Inc.
   12.44 + */
   12.45 +
   12.46 +package org.netbeans.modules.jackpot30.ui;
   12.47 +
   12.48 +import com.sun.source.util.TreePath;
   12.49 +import java.awt.Toolkit;
   12.50 +import java.awt.datatransfer.Clipboard;
   12.51 +import java.awt.datatransfer.StringSelection;
   12.52 +import java.awt.event.ActionEvent;
   12.53 +import java.io.IOException;
   12.54 +import javax.lang.model.element.Element;
   12.55 +import javax.swing.text.JTextComponent;
   12.56 +import org.netbeans.api.editor.EditorActionRegistration;
   12.57 +import org.netbeans.api.java.source.CompilationController;
   12.58 +import org.netbeans.api.java.source.JavaSource;
   12.59 +import org.netbeans.api.java.source.JavaSource.Phase;
   12.60 +import org.netbeans.api.java.source.Task;
   12.61 +import org.netbeans.editor.BaseAction;
   12.62 +import org.openide.awt.StatusDisplayer;
   12.63 +import org.openide.util.Exceptions;
   12.64 +import org.openide.util.Lookup;
   12.65 +import org.openide.util.NbBundle.Messages;
   12.66 +import org.openide.util.datatransfer.ExClipboard;
   12.67 +
   12.68 +@Messages("generate-jackpot-script=Generate Jackpot Script")
   12.69 +@EditorActionRegistration(name = "generate-jackpot-script")
   12.70 +public final class GenerateJackpotScript extends BaseAction {
   12.71 +
   12.72 +    public GenerateJackpotScript() {
   12.73 +        super();
   12.74 +    }
   12.75 +
   12.76 +    @Override
   12.77 +    public void actionPerformed(ActionEvent evt, JTextComponent target) {
   12.78 +        JavaSource js = JavaSource.forDocument(target.getDocument());
   12.79 +
   12.80 +        if (js == null) {
   12.81 +            StatusDisplayer.getDefault().setStatusText("Not a Java file.");
   12.82 +            return ;
   12.83 +        }
   12.84 +
   12.85 +        final int caret = target.getCaretPosition();
   12.86 +
   12.87 +        try {
   12.88 +            js.runUserActionTask(new Task<CompilationController>() {
   12.89 +                @Override public void run(CompilationController parameter) throws Exception {
   12.90 +                    parameter.toPhase(Phase.RESOLVED);
   12.91 +                    TreePath tp = parameter.getTreeUtilities().pathFor(caret);
   12.92 +                    Element  el = parameter.getTrees().getElement(tp);
   12.93 +
   12.94 +                    if (el != null) {
   12.95 +                        String script = PatternGenerator.generateFindUsagesScript(parameter, el);
   12.96 +                        Clipboard clipboard = Lookup.getDefault().lookup(ExClipboard.class);
   12.97 +
   12.98 +                        if (clipboard == null) {
   12.99 +                            clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  12.100 +                        }
  12.101 +
  12.102 +                        clipboard.setContents(new StringSelection(script), null);
  12.103 +
  12.104 +                        StatusDisplayer.getDefault().setStatusText("Script generated into clipboard.");
  12.105 +                    } else {
  12.106 +                        StatusDisplayer.getDefault().setStatusText("Cannot resolve Java element.");
  12.107 +                    }
  12.108 +                }
  12.109 +            }, true);
  12.110 +        } catch (IOException ex) {
  12.111 +            Exceptions.printStackTrace(ex);
  12.112 +        }
  12.113 +    }
  12.114 +
  12.115 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/PatternGenerator.java	Sat Feb 18 22:14:42 2012 +0100
    13.3 @@ -0,0 +1,146 @@
    13.4 +/*
    13.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    13.6 + *
    13.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    13.8 + *
    13.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   13.10 + * Other names may be trademarks of their respective owners.
   13.11 + *
   13.12 + * The contents of this file are subject to the terms of either the GNU
   13.13 + * General Public License Version 2 only ("GPL") or the Common
   13.14 + * Development and Distribution License("CDDL") (collectively, the
   13.15 + * "License"). You may not use this file except in compliance with the
   13.16 + * License. You can obtain a copy of the License at
   13.17 + * http://www.netbeans.org/cddl-gplv2.html
   13.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   13.19 + * specific language governing permissions and limitations under the
   13.20 + * License.  When distributing the software, include this License Header
   13.21 + * Notice in each file and include the License file at
   13.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   13.23 + * particular file as subject to the "Classpath" exception as provided
   13.24 + * by Oracle in the GPL Version 2 section of the License file that
   13.25 + * accompanied this code. If applicable, add the following below the
   13.26 + * License Header, with the fields enclosed by brackets [] replaced by
   13.27 + * your own identifying information:
   13.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   13.29 + *
   13.30 + * If you wish your version of this file to be governed by only the CDDL
   13.31 + * or only the GPL Version 2, indicate your decision by adding
   13.32 + * "[Contributor] elects to include this software in this distribution
   13.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   13.34 + * single choice of license, a recipient has the option to distribute
   13.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   13.36 + * to extend the choice of license to its licensees as provided above.
   13.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   13.38 + * Version 2 license, then the option applies only if the new code is
   13.39 + * made subject to such option by the copyright holder.
   13.40 + *
   13.41 + * Contributor(s):
   13.42 + *
   13.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   13.44 + */
   13.45 +
   13.46 +package org.netbeans.modules.jackpot30.ui;
   13.47 +
   13.48 +import javax.lang.model.element.Element;
   13.49 +import javax.lang.model.element.ExecutableElement;
   13.50 +import javax.lang.model.element.Modifier;
   13.51 +import javax.lang.model.element.TypeElement;
   13.52 +import javax.lang.model.element.VariableElement;
   13.53 +import org.netbeans.api.annotations.common.CheckForNull;
   13.54 +import org.netbeans.api.annotations.common.NonNull;
   13.55 +import org.netbeans.api.java.source.CompilationInfo;
   13.56 +
   13.57 +/**
   13.58 + *
   13.59 + * @author lahvac
   13.60 + */
   13.61 +public class PatternGenerator {
   13.62 +
   13.63 +    public static @CheckForNull String generateFindUsagesScript(CompilationInfo info, Element usagesOf) {
   13.64 +        switch (usagesOf.getKind()) {
   13.65 +            case METHOD: return generateMethodFindUsagesScript(info, (ExecutableElement) usagesOf);
   13.66 +            case ENUM_CONSTANT:
   13.67 +            case FIELD: return generateFieldFindUsagesScript(info, (VariableElement) usagesOf);
   13.68 +            case ANNOTATION_TYPE:
   13.69 +            case CLASS:
   13.70 +            case ENUM:
   13.71 +            case INTERFACE: return generateClassFindUsagesScript(info, (TypeElement) usagesOf);
   13.72 +            default: return null;
   13.73 +        }
   13.74 +    }
   13.75 +
   13.76 +    private static @NonNull String generateMethodFindUsagesScript(CompilationInfo info, ExecutableElement usagesOf) {
   13.77 +        StringBuilder script = new StringBuilder();
   13.78 +        StringBuilder parameters = new StringBuilder();
   13.79 +        StringBuilder constraints = new StringBuilder();
   13.80 +        String enclosingType = info.getTypes().erasure(usagesOf.getEnclosingElement().asType()).toString();
   13.81 +        int count = 1;
   13.82 +
   13.83 +        if (usagesOf.getModifiers().contains(Modifier.STATIC)) {
   13.84 +            script.append(enclosingType);
   13.85 +        } else {
   13.86 +            script.append("$this");
   13.87 +            constraints.append("$this instanceof ").append(enclosingType);
   13.88 +        }
   13.89 +
   13.90 +        script.append(".").append(usagesOf.getSimpleName()).append("(");
   13.91 +
   13.92 +        for (VariableElement p : usagesOf.getParameters()) {
   13.93 +            if (count > 1) {
   13.94 +                parameters.append(", ");
   13.95 +            }
   13.96 +
   13.97 +            if (constraints.length() > 0) {
   13.98 +                constraints.append(" && ");
   13.99 +            }
  13.100 +            parameters.append("$").append(count);
  13.101 +            constraints.append("$").append(count).append(" instanceof ").append(info.getTypes().erasure(p.asType()));
  13.102 +            count++;
  13.103 +        }
  13.104 +
  13.105 +        script.append(parameters).append(")");
  13.106 +
  13.107 +        if (constraints.length() > 0) {
  13.108 +            script.append(" :: ").append(constraints);
  13.109 +        }
  13.110 +
  13.111 +        script.append(";;");
  13.112 +
  13.113 +        return script.toString();
  13.114 +    }
  13.115 +
  13.116 +    private static @NonNull String generateFieldFindUsagesScript(CompilationInfo info, VariableElement usagesOf) {
  13.117 +        StringBuilder script = new StringBuilder();
  13.118 +        StringBuilder constraints = new StringBuilder();
  13.119 +        String enclosingType = info.getTypes().erasure(usagesOf.getEnclosingElement().asType()).toString();
  13.120 +        int count = 1;
  13.121 +
  13.122 +        if (usagesOf.getModifiers().contains(Modifier.STATIC)) {
  13.123 +            script.append(enclosingType);
  13.124 +        } else {
  13.125 +            script.append("$this");
  13.126 +            constraints.append("$this instanceof ").append(enclosingType);
  13.127 +        }
  13.128 +
  13.129 +        script.append(".").append(usagesOf.getSimpleName());
  13.130 +
  13.131 +        if (constraints.length() > 0) {
  13.132 +            script.append(" :: ").append(constraints);
  13.133 +        }
  13.134 +
  13.135 +        script.append(";;");
  13.136 +
  13.137 +        return script.toString();
  13.138 +    }
  13.139 +
  13.140 +    private static @NonNull String generateClassFindUsagesScript(CompilationInfo info, TypeElement usagesOf) {
  13.141 +        StringBuilder script = new StringBuilder();
  13.142 +
  13.143 +        script.append(usagesOf.getQualifiedName());
  13.144 +        script.append(";;");
  13.145 +
  13.146 +        return script.toString();
  13.147 +    }
  13.148 +
  13.149 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/language/ide/ui/src/org/netbeans/modules/jackpot30/ui/layer.xml	Sat Feb 18 22:14:42 2012 +0100
    14.3 @@ -0,0 +1,15 @@
    14.4 +<?xml version="1.0" encoding="UTF-8"?>
    14.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
    14.6 +<filesystem>
    14.7 +    <folder name="Editors">
    14.8 +        <folder name="text">
    14.9 +            <folder name="x-java">
   14.10 +                <folder name="Popup">
   14.11 +                    <file name="generate-jackpot-script">
   14.12 +                        <attr name="position" intvalue="1590" />
   14.13 +                    </file>
   14.14 +                </folder>
   14.15 +            </folder>
   14.16 +        </folder>
   14.17 +    </folder>
   14.18 +</filesystem>
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/language/ide/ui/test/unit/src/org/netbeans/modules/jackpot30/ui/PatternGeneratorTest.java	Sat Feb 18 22:14:42 2012 +0100
    15.3 @@ -0,0 +1,134 @@
    15.4 +/*
    15.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    15.6 + *
    15.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    15.8 + *
    15.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   15.10 + * Other names may be trademarks of their respective owners.
   15.11 + *
   15.12 + * The contents of this file are subject to the terms of either the GNU
   15.13 + * General Public License Version 2 only ("GPL") or the Common
   15.14 + * Development and Distribution License("CDDL") (collectively, the
   15.15 + * "License"). You may not use this file except in compliance with the
   15.16 + * License. You can obtain a copy of the License at
   15.17 + * http://www.netbeans.org/cddl-gplv2.html
   15.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   15.19 + * specific language governing permissions and limitations under the
   15.20 + * License.  When distributing the software, include this License Header
   15.21 + * Notice in each file and include the License file at
   15.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   15.23 + * particular file as subject to the "Classpath" exception as provided
   15.24 + * by Oracle in the GPL Version 2 section of the License file that
   15.25 + * accompanied this code. If applicable, add the following below the
   15.26 + * License Header, with the fields enclosed by brackets [] replaced by
   15.27 + * your own identifying information:
   15.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   15.29 + *
   15.30 + * If you wish your version of this file to be governed by only the CDDL
   15.31 + * or only the GPL Version 2, indicate your decision by adding
   15.32 + * "[Contributor] elects to include this software in this distribution
   15.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   15.34 + * single choice of license, a recipient has the option to distribute
   15.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   15.36 + * to extend the choice of license to its licensees as provided above.
   15.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   15.38 + * Version 2 license, then the option applies only if the new code is
   15.39 + * made subject to such option by the copyright holder.
   15.40 + *
   15.41 + * Contributor(s):
   15.42 + *
   15.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   15.44 + */
   15.45 +
   15.46 +package org.netbeans.modules.jackpot30.ui;
   15.47 +
   15.48 +import com.sun.source.util.TreePath;
   15.49 +import java.util.List;
   15.50 +import java.util.concurrent.atomic.AtomicBoolean;
   15.51 +import org.netbeans.api.java.source.CompilationInfo;
   15.52 +import org.netbeans.modules.java.hints.infrastructure.TreeRuleTestBase;
   15.53 +import org.netbeans.modules.java.hints.jackpot.impl.hints.HintsInvoker;
   15.54 +import org.netbeans.modules.java.hints.jackpot.spi.PatternConvertor;
   15.55 +import org.netbeans.spi.editor.hints.ErrorDescription;
   15.56 +
   15.57 +/**
   15.58 + *
   15.59 + * @author lahvac
   15.60 + */
   15.61 +public class PatternGeneratorTest extends TreeRuleTestBase {
   15.62 +
   15.63 +    public PatternGeneratorTest(String name) {
   15.64 +        super(name);
   15.65 +    }
   15.66 +
   15.67 +    public void testStaticMethod() throws Exception {
   15.68 +        performTest("package test;\n" +
   15.69 +                    "public class Test {\n" +
   15.70 +                    "    public static void te|st(int i, String s) {\n" +
   15.71 +                    "        test(i, s);\n" +
   15.72 +                    "    }\n" +
   15.73 +                    "}\n",
   15.74 +                    "3:8-3:12:verifier:TODO: No display name");
   15.75 +    }
   15.76 +
   15.77 +    public void testInstanceMethod() throws Exception {
   15.78 +        performTest("package test;\n" +
   15.79 +                    "public class Test {\n" +
   15.80 +                    "    public void te|st(int i, String s) {\n" +
   15.81 +                    "        new Test().test(i, s);\n" +
   15.82 +                    "        test(i, s);\n" +
   15.83 +                    "    }\n" +
   15.84 +                    "}\n",
   15.85 +                    "3:19-3:23:verifier:TODO: No display name",
   15.86 +                    "4:8-4:12:verifier:TODO: No display name");
   15.87 +    }
   15.88 +
   15.89 +    public void testStaticField() throws Exception {
   15.90 +        performTest("package test;\n" +
   15.91 +                    "public class Test {\n" +
   15.92 +                    "    public static int I|I = 0;" +
   15.93 +                    "    public int test() {\n" +
   15.94 +                    "        return II;\n" +
   15.95 +                    "    }\n" +
   15.96 +                    "}\n",
   15.97 +                    "3:15-3:17:verifier:TODO: No display name");
   15.98 +    }
   15.99 +
  15.100 +    public void testInstanceField() throws Exception {
  15.101 +        performTest("package test;\n" +
  15.102 +                    "public class Test {\n" +
  15.103 +                    "    public int I|I = 0;" +
  15.104 +                    "    public int test() {\n" +
  15.105 +                    "        if (true) return II; else return new Test().II;\n" +
  15.106 +                    "    }\n" +
  15.107 +                    "}\n",
  15.108 +                    "3:25-3:27:verifier:TODO: No display name",
  15.109 +                    "3:52-3:54:verifier:TODO: No display name");
  15.110 +    }
  15.111 +
  15.112 +    private void performTest(String code, String... golden) throws Exception {
  15.113 +        performAnalysisTest("test/Test.java",
  15.114 +                            code,
  15.115 +                            golden);
  15.116 +    }
  15.117 +
  15.118 +    @Override
  15.119 +    protected List<ErrorDescription> computeErrors(CompilationInfo info, TreePath path) {
  15.120 +        String script = PatternGenerator.generateFindUsagesScript(info, info.getTrees().getElement(path));
  15.121 +
  15.122 +        return new HintsInvoker(info, new AtomicBoolean()).computeHints(info, PatternConvertor.create(script));
  15.123 +    }
  15.124 +
  15.125 +    @Override
  15.126 +    public void testIssue105979() throws Exception {}
  15.127 +
  15.128 +    @Override
  15.129 +    public void testIssue108246() throws Exception {}
  15.130 +
  15.131 +    @Override
  15.132 +    public void testIssue113933() throws Exception {}
  15.133 +
  15.134 +    @Override
  15.135 +    public void testNoHintsForSimpleInitialize() throws Exception {}
  15.136 +
  15.137 +}