1. Jan Lahoda
  2. jackpot30

Commits

Jan Lahoda  committed 9585d96

Introducing a new module to hold rules ported from the original jackpot project.

  • Participants
  • Parent commits 5564a7f
  • Branches default

Comments (0)

Files changed (14)

File jackpot/build.xml

View file
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
+<!-- for some information on what you could do (e.g. targets to override). -->
+<!-- If you delete this file and reopen the project it will be recreated. -->
+<project name="org.netbeans.modules.jackpot30.jackpot" default="netbeans" basedir=".">
+    <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.jackpot.</description>
+    <import file="nbproject/build-impl.xml"/>
+    <import file="${suite.dir}/findbugs-import.xml"/>
+</project>

File jackpot/manifest.mf

View file
+Manifest-Version: 1.0
+AutoUpdate-Show-In-Client: false
+OpenIDE-Module: org.netbeans.modules.jackpot30.jackpot
+OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/jackpot/layer.xml
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/jackpot/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.2
+

File jackpot/nbproject/build-impl.xml

View file
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT  ***
+***         EDIT ../build.xml INSTEAD         ***
+-->
+<project name="org.netbeans.modules.jackpot30.jackpot-impl" basedir="..">
+    <fail message="Please build using Ant 1.7.1 or higher.">
+        <condition>
+            <not>
+                <antversion atleast="1.7.1"/>
+            </not>
+        </condition>
+    </fail>
+    <property file="nbproject/private/suite-private.properties"/>
+    <property file="nbproject/suite.properties"/>
+    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
+    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
+    <property file="${suite.dir}/nbproject/platform.properties"/>
+    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
+        <attribute name="name"/>
+        <attribute name="value"/>
+        <sequential>
+            <property name="@{name}" value="${@{value}}"/>
+        </sequential>
+    </macrodef>
+    <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
+        <attribute name="property"/>
+        <attribute name="value"/>
+        <sequential>
+            <property name="@{property}" value="@{value}"/>
+        </sequential>
+    </macrodef>
+    <property file="${user.properties.file}"/>
+    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+    <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+    <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+    <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
+        <condition>
+            <not>
+                <contains string="${cluster.path.evaluated}" substring="platform"/>
+            </not>
+        </condition>
+    </fail>
+    <import file="${harness.dir}/build.xml"/>
+</project>

File jackpot/nbproject/genfiles.properties

View file
+build.xml.data.CRC32=e44fd480
+build.xml.script.CRC32=056a9d16
+build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=df7993f5
+nbproject/build-impl.xml.script.CRC32=b49b9efa
+nbproject/build-impl.xml.stylesheet.CRC32=261c4bef@1.28.0.7

File jackpot/nbproject/platform.properties

View file
+cluster.path=\
+    ${nbplatform.active.dir}/identity:\
+    ${nbplatform.active.dir}/enterprise:\
+    ${nbplatform.active.dir}/webcommon:\
+    ${nbplatform.active.dir}/mobility:\
+    ${nbplatform.active.dir}/php:\
+    ${nbplatform.active.dir}/harness:\
+    ${nbplatform.active.dir}/dlight:\
+    ${nbplatform.active.dir}/profiler:\
+    ${nbplatform.active.dir}/platform:\
+    ${nbplatform.active.dir}/websvccommon:\
+    ${nbplatform.active.dir}/nb:\
+    ${nbplatform.active.dir}/apisupport:\
+    ${nbplatform.active.dir}/cnd:\
+    ${nbplatform.active.dir}/ergonomics:\
+    ${nbplatform.active.dir}/java:\
+    ${nbplatform.active.dir}/groovy:\
+    ${nbplatform.active.dir}/ruby:\
+    ${nbplatform.active.dir}/ide
+nbplatform.active=default

File jackpot/nbproject/project.properties

View file
+javac.source=1.5
+javac.compilerargs=-Xlint -Xlint:-serial

File jackpot/nbproject/project.xml

View file
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.apisupport.project</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+            <code-name-base>org.netbeans.modules.jackpot30.jackpot</code-name-base>
+            <suite-component/>
+            <module-dependencies/>
+            <test-dependencies>
+                <test-type>
+                    <name>unit</name>
+                    <test-dependency>
+                        <code-name-base>org.netbeans.modules.jackpot30.file</code-name-base>
+                        <recursive/>
+                        <compile-dependency/>
+                        <test/>
+                    </test-dependency>
+                    <test-dependency>
+                        <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
+                        <recursive/>
+                        <compile-dependency/>
+                        <test/>
+                    </test-dependency>
+                </test-type>
+            </test-dependencies>
+            <public-packages/>
+        </data>
+    </configuration>
+</project>

File jackpot/nbproject/suite.properties

View file
+suite.dir=${basedir}/..

File jackpot/src/org/netbeans/modules/jackpot30/jackpot/AddConditionals.hint

View file
+if ($a) return $b; else return $c; => return $a ? $b : $c; ;;
+if ($a) $ret = $b; else $ret = $c; => $ret = $a ? $b : $c; ;;
+if ($a) $b=$c; else if ($a2) $b = $d; => $b = $a ? $c : $a2 ? $d : $b; ;;
+$a ? ($T)$b : ($T)$c => ($T)($a ? $b : $c) ;;
+{ $p$; $T $v; if($a) $v = $b; else $v = $c; $q$; } => { $p$; $T $v = $a ? $b : $c; $q$; }  ;;
+

File jackpot/src/org/netbeans/modules/jackpot30/jackpot/Bundle.properties

View file
+OpenIDE-Module-Name=Jackpot 3.0 - Jackpot Rules

File jackpot/src/org/netbeans/modules/jackpot30/jackpot/layer.xml

View file
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
+<filesystem>
+
+    <folder name="org-netbeans-modules-java-hints">
+        <folder name="declarative">
+            <file name="AddConditionals.hint" url="AddConditionals.hint" />
+        </folder>
+    </folder>
+
+</filesystem>

File jackpot/test/unit/src/org/netbeans/modules/jackpot30/jackpot/AddConditionals.test

View file
+%%TestCase simple-return
+package test;
+public class Test {
+    public int test(boolean b) {
+        if (b)
+            return 1;
+        else
+            return 2;
+    }
+}
+%%=>
+package test;
+public class Test {
+    public int test(boolean b) {
+        return b ? 1 : 2;
+    }
+}
+%%TestCase blocks-return
+package test;
+public class Test {
+    public int test(boolean b) {
+        if (b) {
+            return 1;
+        } else {
+            return 2;
+        }
+    }
+}
+%%=>
+package test;
+public class Test {
+    public int test(boolean b) {
+        return b ? 1 : 2;
+    }
+}
+%%TestCase simple-assignment
+package test;
+public class Test {
+    public void test(boolean b) {
+        int q;
+        if (b)
+            q = 1;
+        else
+            q = 2;
+    }
+}
+%%=>
+package test;
+public class Test {
+    public void test(boolean b) {
+        int q;
+        q = b ? 1 : 2;
+    }
+}
+%%TestCase simplify-conditional-with-casts
+package test;
+public class Test {
+    public void test(boolean b, Object o1, Object o2) {
+        String s = b ? (String) o1 : (String) o2;
+    }
+}
+%%=>
+package test;
+public class Test {
+    public void test(boolean b, Object o1, Object o2) {
+        String s = (String) (b ? o1 : o2);
+    }
+}

File jackpot/test/unit/src/org/netbeans/modules/jackpot30/jackpot/HintsTest.java

View file
+package org.netbeans.modules.jackpot30.jackpot;
+
+import junit.framework.TestSuite;
+import org.netbeans.modules.jackpot30.file.test.spi.DeclarativeHintsTestBase;
+
+/**
+ *
+ * @author lahvac
+ */
+public class HintsTest extends DeclarativeHintsTestBase {
+
+    public static TestSuite suite() {
+        return suite(HintsTest.class);
+    }
+
+}

File nbproject/project.properties

View file
     ${project.org.netbeans.modules.jackpot30.code}:\
     ${project.org.netbeans.modules.jackpot30.file}:\
     ${project.org.netbeans.modules.jackpot30.transformers}:\
-    ${project.org.netbeans.modules.jackpot30.kit}
+    ${project.org.netbeans.modules.jackpot30.kit}:\
+    ${project.org.netbeans.modules.jackpot30.jackpot}
 project.org.netbeans.modules.jackpot30.api=api
 project.org.netbeans.modules.jackpot30.code=code
 project.org.netbeans.modules.jackpot30.file=file
 project.org.netbeans.modules.jackpot30.hintsimpl=hintsimpl
+project.org.netbeans.modules.jackpot30.jackpot=jackpot
 project.org.netbeans.modules.jackpot30.kit=kit
 project.org.netbeans.modules.jackpot30.test.borrowed=borrowedtests