Skip to content

Commit cfce2bb

Browse files
author
mgricken
committed
Java 7 support in DrJava. Removed plenty of new warnings.
ConcJUnit is currently incompatible with Java 7, had to be disabled for now. git-svn-id: file:///tmp/test-svn/trunk@5436 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent d39fc44 commit cfce2bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2140
-1598
lines changed

drjava/build.xml

Lines changed: 96 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<property name="test-repeat" value="1" />
2424
<property name="test-timeout" value="1440" />
2525
<property name="test-formatter" value="oneline" />
26-
<property name="use-concjunit" value="true" />
2726
<property name="findbugs-formatter" value="html" />
2827
<property name="test-halt" value="false" />
2928
<property name="force-server" value="no" />
@@ -41,6 +40,7 @@
4140
<property name="drjava.test.config" value="testFiles/drjava.basic.config" />
4241

4342
<property environment="env" />
43+
<property name="java7-home" value="${env.JAVA7_HOME}" />
4444
<property name="java6-home" value="${env.JAVA6_HOME}" />
4545
<property name="java5-home" value="${env.JAVA5_HOME}" />
4646
<property name="launch4j-home" value="${env.LAUNCH4J_HOME}" />
@@ -68,7 +68,18 @@
6868

6969
<fileset id="libs" dir="lib" includes="*.jar" /> <!-- Only include jars that are at the top level (not in buildlib) -->
7070

71-
71+
<!-- Use ConcJUnit if use-concjunit is not defined and we are not running Java 7. -->
72+
<!-- ConcJUnit is currently incompatible with Java 7. -->
73+
<if>
74+
<contains string="${java.version}" substring="1.7"/>
75+
<then>
76+
<echo message="ConcJUnit is currently incompatible with Java 7."/>
77+
<property name="use-concjunit" value="false" />
78+
</then>
79+
<else>
80+
<property name="use-concjunit" value="true" />
81+
</else>
82+
</if>
7283

7384
<!-- ************
7485
Help Targets
@@ -91,6 +102,8 @@
91102
<echo message=" compiling and '-5' targets)" />
92103
<echo message="JAVA6_HOME: Home folder of the Java 6 JRE or JDK (required for" />
93104
<echo message=" '-6' targets)" />
105+
<echo message="JAVA7_HOME: Home folder of the Java 7 JRE or JDK (required for" />
106+
<echo message=" '-7' targets)" />
94107
<echo message="LAUNCH4J_HOME: Location of the Launch4j installation (used to " />
95108
<echo message=" release a Windows application)" />
96109
<echo message="CLOVER_JAR: Location of the Clover jar file" />
@@ -296,6 +309,17 @@
296309
<antcall target="iterate-tests">
297310
<param name="test-jvm" value="java" />
298311
<param name="test-tools" value="${current-tools}" />
312+
<param name="test-force-disable-concjunit" value="false" />
313+
</antcall>
314+
</target>
315+
316+
<target name="test-7" depends="compile, resolve-java7-exec, resolve-java7-tools" unless="skip-test"
317+
description="Run all tests under Java 7 (after compiling); use -Dtest-spec=... to filter">
318+
<echo message="ConcJUnit is currently incompatible with Java 7."/>
319+
<antcall target="iterate-tests">
320+
<param name="test-jvm" value="${java7-exec}" />
321+
<param name="test-tools" value="${java7-tools}" />
322+
<param name="test-force-disable-concjunit" value="true" />
299323
</antcall>
300324
</target>
301325

@@ -304,6 +328,7 @@
304328
<antcall target="iterate-tests">
305329
<param name="test-jvm" value="${java6-exec}" />
306330
<param name="test-tools" value="${java6-tools}" />
331+
<param name="test-force-disable-concjunit" value="false" />
307332
</antcall>
308333
</target>
309334

@@ -312,6 +337,7 @@
312337
<antcall target="iterate-tests">
313338
<param name="test-jvm" value="${java5-exec}" />
314339
<param name="test-tools" value="${java5-tools}" />
340+
<param name="test-force-disable-concjunit" value="false" />
315341
</antcall>
316342
</target>
317343

@@ -401,7 +427,7 @@
401427

402428

403429
<target name="do-test" depends="resolve-jvm-args, resolve-junit-jar">
404-
<echo message="Running all tests matching '${test-filter-string}' with command '${test-jvm}', using '${junit-jar}'" />
430+
<echo message="Running all tests matching '${test-filter-string}' with command '${test-jvm}', using '${junit-jar}' and '${test-tools}'" />
405431
<extendclasspath path="${junit-jar}" />
406432
<junit haltonfailure="${test-halt}" failureproperty="test-failed"
407433
fork="yes" forkmode="perTest" maxmemory="800M" jvm="${test-jvm}" dir="${basedir}">
@@ -442,6 +468,13 @@
442468
</antcall>
443469
</target>
444470

471+
<target name="run-7" depends="compile, resolve-java7-exec"
472+
description="Run the main class under Java 7 (after compiling)">
473+
<antcall target="do-run">
474+
<param name="run-jvm" value="${java7-exec}" />
475+
</antcall>
476+
</target>
477+
445478
<target name="run-6" depends="compile, resolve-java6-exec"
446479
description="Run the main class under Java 6 (after compiling)">
447480
<antcall target="do-run">
@@ -481,6 +514,13 @@
481514
</antcall>
482515
</target>
483516

517+
<target name="run-jar-7" depends="jar, resolve-java7-exec"
518+
description="Run the jar file under Java 7 (after building it)">
519+
<antcall target="do-run-jar">
520+
<param name="run-jvm" value="${java7-exec}" />
521+
</antcall>
522+
</target>
523+
484524
<target name="run-jar-6" depends="jar, resolve-java6-exec"
485525
description="Run the jar file under Java 6 (after building it)">
486526
<antcall target="do-run-jar">
@@ -592,6 +632,9 @@
592632
<target name="clover" depends="clean, setup-clover, test, report-clover"
593633
description="Generate a Clover test coverage report" />
594634

635+
<target name="clover-7" depends="clean, setup-clover, test-7, report-clover"
636+
description="Generate a Clover test coverage report under Java 7" />
637+
595638
<target name="clover-6" depends="clean, setup-clover, test-6, report-clover"
596639
description="Generate a Clover test coverage report under Java 6" />
597640

@@ -1209,6 +1252,39 @@
12091252
Property-resolution Targets
12101253
*************************** -->
12111254

1255+
<target name="resolve-java7-runtime">
1256+
<!-- We rely on "location" to generate a platform-specific path; note that properties
1257+
are immutable and so java7-runtime will only be set the *first* time. -->
1258+
1259+
<property name="java7-runtime-1" location="${java7-home}/lib/rt.jar" />
1260+
<available property="java7-runtime" value="${java7-runtime-1}" file="${java7-runtime-1}" />
1261+
1262+
<property name="java7-runtime-2" location="${java7-home}/jre/lib/rt.jar" />
1263+
<available property="java7-runtime" value="${java7-runtime-2}" file="${java7-runtime-2}" />
1264+
1265+
<property name="java7-runtime-3" location="${java7-home}/../Classes/classes.jar" />
1266+
<available property="java7-runtime" value="${java7-runtime-3}" file="${java7-runtime-3}" />
1267+
1268+
<fail message="Can't find rt.jar in the Java 7 home: ${java7-home}" unless="java7-runtime" />
1269+
</target>
1270+
1271+
<target name="resolve-java7-exec">
1272+
<!-- We rely on "location" to generate a platform-specific path -->
1273+
1274+
<property name="java7-exec-1" location="${java7-home}/bin/java.exe" />
1275+
<condition property="java7-exec" value="${java7-exec-1}">
1276+
<and>
1277+
<available file="${java7-exec-1}" />
1278+
<os family="windows" />
1279+
</and>
1280+
</condition>
1281+
1282+
<property name="java7-exec-2" location="${java7-home}/bin/java" />
1283+
<available property="java7-exec" value="${java7-exec-2}" file="${java7-exec-2}" />
1284+
1285+
<fail message="Can't find the java executable in the Java 7 home: ${java7-home}" unless="java7-exec" />
1286+
</target>
1287+
12121288
<target name="resolve-java6-runtime">
12131289
<!-- We rely on "location" to generate a platform-specific path; note that properties
12141290
are immutable and so java6-runtime will only be set the *first* time. -->
@@ -1275,6 +1351,19 @@
12751351
<fail message="Can't find the java executable in the Java 5 home: ${java5-home}" unless="java5-exec" />
12761352
</target>
12771353

1354+
<target name="resolve-java7-tools">
1355+
<property name="java7-tools-1" location="${java7-home}/lib/tools.jar" />
1356+
<available property="java7-tools" value="${java7-tools-1}" file="${java7-tools-1}" />
1357+
1358+
<property name="java7-tools-2" location="${java7-home}/../lib/tools.jar" />
1359+
<available property="java7-tools" value="${java7-tools-2}" file="${java7-tools-2}" />
1360+
1361+
<property name="java7-tools-3" location="${java7-home}/../Classes/classes.jar" />
1362+
<available property="java7-tools" value="${java7-tools-3}" file="${java7-tools-3}" />
1363+
1364+
<fail message="Can't find tools.jar in the Java 7 home: ${java7-home}" unless="java7-tools" />
1365+
</target>
1366+
12781367
<target name="resolve-java6-tools">
12791368
<property name="java6-tools-1" location="${java6-home}/lib/tools.jar" />
12801369
<available property="java6-tools" value="${java6-tools-1}" file="${java6-tools-1}" />
@@ -1468,7 +1557,10 @@
14681557
***************** -->
14691558
<target name="resolve-junit-jar">
14701559
<if>
1471-
<istrue value="${use-concjunit}" />
1560+
<and>
1561+
<istrue value="${use-concjunit}" />
1562+
<isfalse value="${test-force-disable-concjunit}" />
1563+
</and>
14721564
<then>
14731565
<property name="junit-jar-1" location="lib/buildlib/concutest-junit-4.7-withrt-nodep.jar" />
14741566
<available property="junit-jar" value="${junit-jar-1}" file="${junit-jar-1}" />

drjava/lib/dynamicjava-base.jar

495 Bytes
Binary file not shown.

drjava/lib/javalanglevels-base.jar

68 Bytes
Binary file not shown.

drjava/lib/platform.jar

4.36 KB
Binary file not shown.

drjava/lib/plt.jar

494 Bytes
Binary file not shown.

drjava/src/edu/rice/cs/drjava/config/DrJavaPropertySetup.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ public void resetAttributes() {
707707
public Boolean value(Double op1, Double op2) { return (op1>op2); }
708708
};
709709

710-
BinaryOpProperty prop17 =
710+
BinaryOpProperty<Double,Double,Boolean> prop17 =
711711
new BinaryOpProperty<Double,Double,Boolean>("gt",
712712
msg17,
713713
lam17,
@@ -727,7 +727,7 @@ public void resetAttributes() {
727727
public Boolean value(Double op1, Double op2) { return (op1<op2); }
728728
};
729729

730-
BinaryOpProperty prop18 =
730+
BinaryOpProperty<Double,Double,Boolean> prop18 =
731731
new BinaryOpProperty<Double,Double,Boolean>("lt",
732732
msg18,
733733
lam18,

drjava/src/edu/rice/cs/drjava/config/OptionConstants.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,10 +1251,11 @@ public static ArrayList<String> evaluate() {
12511251
static final String JAVADOC_1_4_TEXT = "1.4";
12521252
static final String JAVADOC_1_5_TEXT = "1.5";
12531253
static final String JAVADOC_1_6_TEXT = "1.6";
1254+
static final String JAVADOC_1_7_TEXT = "1.7";
12541255
static final String JAVADOC_AUTO_TEXT = "use compiler version"; // for "Open Java API Javadoc"
12551256

12561257
static final String[] linkChoices = new String[]{
1257-
JAVADOC_NONE_TEXT, JAVADOC_1_5_TEXT, JAVADOC_1_6_TEXT };
1258+
JAVADOC_NONE_TEXT, JAVADOC_1_5_TEXT, JAVADOC_1_6_TEXT, JAVADOC_1_7_TEXT };
12581259
static final ArrayList<String> linkVersionChoices = new ArrayList<String>(Arrays.asList(linkChoices));
12591260

12601261
static final String[] linkDeprecated = new String[]{
@@ -1270,16 +1271,19 @@ public static ArrayList<String> evaluate() {
12701271
new StringOption("javadoc.1.5.link", "http://download.oracle.com/javase/1.5.0/docs/api");
12711272
public static final StringOption JAVADOC_1_6_LINK =
12721273
new StringOption("javadoc.1.6.link", "http://download.oracle.com/javase/6/docs/api");
1274+
public static final StringOption JAVADOC_1_7_LINK =
1275+
new StringOption("javadoc.1.7.link", "http://download.oracle.com/javase/7/docs/api/");
12731276

12741277
/** The version of Java to use for links to Javadoc for system classes. */
12751278
public static final ForcedChoiceOption JAVADOC_LINK_VERSION =
12761279
new ForcedChoiceOption("javadoc.link.version",
12771280
(System.getProperty("java.specification.version").startsWith("1.5") ? JAVADOC_1_5_TEXT :
1278-
JAVADOC_1_6_TEXT),
1281+
(System.getProperty("java.specification.version").startsWith("1.6") ? JAVADOC_1_6_TEXT :
1282+
JAVADOC_1_7_TEXT)),
12791283
linkVersionChoices, linkVersionDeprecated);
12801284

12811285
static final String[] apiJavadocChoices = new String[] {
1282-
JAVADOC_1_5_TEXT, JAVADOC_1_6_TEXT, JAVADOC_AUTO_TEXT};
1286+
JAVADOC_1_5_TEXT, JAVADOC_1_6_TEXT, JAVADOC_1_7_TEXT, JAVADOC_AUTO_TEXT};
12831287
static final ArrayList<String> apiJavadocVersionChoices = new ArrayList<String>(Arrays.asList(apiJavadocChoices));
12841288

12851289
static final String[] apiJavadocDeprecated = new String[] {
@@ -1473,25 +1477,23 @@ public static ArrayList<String> evaluate() {
14731477
* compilers that it has
14741478
* Must store the selected name into DEFAULT_COMPILER_PREFERENCE to save the setting
14751479
*/
1476-
public static final class COMPILER_PREFERENCE_CONTROL
1477-
{
1480+
public static final class COMPILER_PREFERENCE_CONTROL {
14781481
public static final String NO_PREFERENCE = "No Preference";
14791482
public static ArrayList<String> _list = new ArrayList<String>();
14801483

1481-
public static void setList(ArrayList<String> list) {_list = list;}
1482-
public static ForcedChoiceOption evaluate()
1483-
{
1484-
_list.add(NO_PREFERENCE);
1484+
public static void setList(ArrayList<String> list) { _list = list; }
1485+
public static ForcedChoiceOption evaluate() {
1486+
if (!_list.contains(NO_PREFERENCE)) {
1487+
_list.add(NO_PREFERENCE);
1488+
}
14851489

14861490
ForcedChoiceOption fco;
14871491
String defaultC = edu.rice.cs.drjava.DrJava.getConfig().getSetting(DEFAULT_COMPILER_PREFERENCE);
14881492

1489-
if(_list.contains(defaultC))
1490-
{
1491-
fco = new ForcedChoiceOption("default.compiler.preference.control", defaultC, _list);
1493+
if (_list.contains(defaultC)) {
1494+
fco = new ForcedChoiceOption("compiler.preference.control", defaultC, _list);
14921495
}
1493-
else
1494-
{
1496+
else {
14951497
fco = new ForcedChoiceOption("compiler.preference.control", NO_PREFERENCE, _list);
14961498
edu.rice.cs.drjava.DrJava.getConfig().setSetting(DEFAULT_COMPILER_PREFERENCE,NO_PREFERENCE);
14971499
}

0 commit comments

Comments
 (0)