Skip to content

Commit 5040cb4

Browse files
committed
Move to Java 8 and upgrade Guava - there are a small number of type safety issues the compiler complains about.
1 parent 16b06c3 commit 5040cb4

File tree

6 files changed

+28
-41
lines changed

6 files changed

+28
-41
lines changed

base/test-core/src/test/java/org/openscience/cdk/config/AtomTypeFactoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public void testGetAtomTypeFromMM2() throws Exception {
285285
Assert.assertEquals("S-[2];[H]{0,3}+=C.*+", atomType.getProperty(CDKConstants.SPHERICAL_MATCHER));
286286
Assert.assertEquals(Hybridization.SP2, atomType.getHybridization());
287287
Assert.assertTrue(atomType.getFlag(CDKConstants.IS_HYDROGENBOND_ACCEPTOR));
288-
Assert.assertEquals(5, atomType.getProperty(CDKConstants.PART_OF_RING_OF_SIZE));
288+
Assert.assertEquals((Integer)5, atomType.getProperty(CDKConstants.PART_OF_RING_OF_SIZE));
289289
}
290290

291291
@Test

base/test-core/src/test/java/org/openscience/cdk/config/atomtypes/AtomTypeReaderTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ public void testReadAtomTypes_CDK() {
118118

119119
Assert.assertEquals(0, atomType.getFormalCharge().intValue());
120120
Assert.assertEquals(IAtomType.Hybridization.SP1, atomType.getHybridization());
121-
Assert.assertEquals(0, atomType.getProperty(CDKConstants.LONE_PAIR_COUNT));
122-
Assert.assertEquals(2, atomType.getProperty(CDKConstants.PI_BOND_COUNT));
121+
Assert.assertEquals(0, (int)atomType.getProperty(CDKConstants.LONE_PAIR_COUNT));
122+
Assert.assertEquals(2, (int)atomType.getProperty(CDKConstants.PI_BOND_COUNT));
123123
}
124124

125125
@Test
@@ -157,7 +157,7 @@ public void testReadAtomTypes_FF() {
157157
Assert.assertFalse(atomType.getFlag(CDKConstants.IS_HYDROGENBOND_ACCEPTOR));
158158
Assert.assertFalse(atomType.getFlag(CDKConstants.IS_HYDROGENBOND_DONOR));
159159

160-
Assert.assertEquals(3, atomType.getProperty(CDKConstants.PART_OF_RING_OF_SIZE));
161-
Assert.assertEquals(3, atomType.getProperty(CDKConstants.CHEMICAL_GROUP_CONSTANT));
160+
Assert.assertEquals((Integer)3, atomType.getProperty(CDKConstants.PART_OF_RING_OF_SIZE));
161+
Assert.assertEquals((Integer)3, atomType.getProperty(CDKConstants.CHEMICAL_GROUP_CONSTANT));
162162
}
163163
}

base/test-core/src/test/java/org/openscience/cdk/config/atomtypes/OWLAtomTypeReaderTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ public void testReadAtomTypes_CDK() {
8888
Assert.assertEquals(0, atomType.getFormalCharge().intValue());
8989
Assert.assertEquals(IAtomType.Hybridization.SP3, atomType.getHybridization());
9090
Assert.assertEquals(4, atomType.getFormalNeighbourCount().intValue());
91-
Assert.assertEquals(0, atomType.getProperty(CDKConstants.LONE_PAIR_COUNT));
92-
Assert.assertEquals(0, atomType.getProperty(CDKConstants.PI_BOND_COUNT));
93-
Assert.assertEquals(0, atomType.getProperty(CDKConstants.SINGLE_ELECTRON_COUNT));
91+
Assert.assertEquals((Integer)0, atomType.getProperty(CDKConstants.LONE_PAIR_COUNT));
92+
Assert.assertEquals((Integer)0, atomType.getProperty(CDKConstants.PI_BOND_COUNT));
93+
Assert.assertEquals((Integer)0, atomType.getProperty(CDKConstants.SINGLE_ELECTRON_COUNT));
9494
}
9595

9696
}

pom.xml

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
53
<modelVersion>4.0.0</modelVersion>
6-
74
<groupId>org.openscience.cdk</groupId>
85
<artifactId>cdk</artifactId>
96
<name>cdk</name>
107
<description>Modular library for Cheminformatics</description>
118
<version>2.4-SNAPSHOT</version>
129
<packaging>pom</packaging>
1310
<url>http://sourceforge.net/projects/cdk/</url>
14-
1511
<modules>
1612
<module>bundle</module>
1713
<module>base</module>
@@ -23,33 +19,28 @@
2319
<module>legacy</module>
2420
<module>app</module>
2521
</modules>
26-
2722
<properties>
2823
<argLine></argLine>
2924
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3025
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
3126
</properties>
32-
3327
<licenses>
3428
<license>
3529
<name>GNU LGPL 2.1 or later</name>
3630
<url>http://www.gnu.org/licenses/lgpl.html</url>
3731
<distribution>repo</distribution>
3832
</license>
3933
</licenses>
40-
4134
<scm>
4235
<url>https://github.com/cdk/cdk</url>
4336
<connection>scm:git:git://github.com/cdk/cdk.git</connection>
4437
<developerConnection>scm:git:git@github.com:cdk/cdk.git
4538
</developerConnection>
4639
</scm>
47-
4840
<issueManagement>
4941
<url>https://github.com/cdk/cdk/issues</url>
5042
<system>SourceForge Tracker</system>
5143
</issueManagement>
52-
5344
<!-- define the cdk.repo.url and cdk.repo.snapshots.url properties in
5445
~/.m2/settings.xml -->
5546
<distributionManagement>
@@ -68,19 +59,15 @@
6859
<url>http://cdk.github.io/cdk/</url>
6960
</site>
7061
</distributionManagement>
71-
7262
<repositories>
7363
<repository>
7464
<id>ossrh</id>
7565
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
76-
7766
</repository>
7867
</repositories>
79-
8068
<prerequisites>
8169
<maven>3.0</maven>
8270
</prerequisites>
83-
8471
<!-- developer = commit access -->
8572
<developers>
8673
<developer>
@@ -104,7 +91,6 @@
10491
<timezone>GMT</timezone>
10592
</developer>
10693
</developers>
107-
10894
<contributors>
10995
<contributor>
11096
<name>Sam Adams</name>
@@ -428,7 +414,6 @@
428414
<name>Daniel Zaharevitz</name>
429415
</contributor>
430416
</contributors>
431-
432417
<!-- Plugin repository (EBI) is required for cdk-build-utils and
433418
ojdcheck to build the javadoc. -->
434419
<pluginRepositories>
@@ -447,8 +432,6 @@
447432
</snapshots>
448433
</pluginRepository>
449434
</pluginRepositories>
450-
451-
452435
<!-- centralised versions for common dependencies -->
453436
<dependencyManagement>
454437
<dependencies>
@@ -465,7 +448,7 @@
465448
<dependency>
466449
<groupId>com.google.guava</groupId>
467450
<artifactId>guava</artifactId>
468-
<version>17.0</version>
451+
<version>29.0-jre</version>
469452
</dependency>
470453
<dependency>
471454
<groupId>junit</groupId>
@@ -504,16 +487,15 @@
504487
</dependency>
505488
</dependencies>
506489
</dependencyManagement>
507-
508490
<build>
509491
<plugins>
510492
<plugin>
511493
<groupId>org.apache.maven.plugins</groupId>
512494
<artifactId>maven-compiler-plugin</artifactId>
513495
<version>2.3.2</version>
514496
<configuration>
515-
<source>1.7</source>
516-
<target>1.7</target>
497+
<source>1.8</source>
498+
<target>1.8</target>
517499
</configuration>
518500
</plugin>
519501
<plugin>
@@ -529,7 +511,6 @@
529511
<exclude>**/TestMoleculeFactory.java</exclude>
530512
<!-- missing functionality -->
531513
<exclude>**/cdk/limitations/**</exclude>
532-
533514
<!-- coverage tests need updating -->
534515
<exclude>**/*CoverageTest.java</exclude>
535516
<!-- module suites not needed -->
@@ -571,31 +552,37 @@
571552
<tag>
572553
<name>cdk.set</name>
573554
<placement>a</placement>
555+
574556
<head>Belongs to the set:</head>
575557
</tag>
576558
<tag>
577559
<name>cdk.keyword</name>
578560
<placement>a</placement>
561+
579562
<head>Keywords:</head>
580563
</tag>
581564
<tag>
582565
<name>cdk.created</name>
583566
<placement>a</placement>
567+
584568
<head>Created on:</head>
585569
</tag>
586570
<tag>
587571
<name>cdk.require</name>
588572
<placement>a</placement>
573+
589574
<head>Requires:</head>
590575
</tag>
591576
<tag>
592577
<name>cdk.todo</name>
593578
<placement>a</placement>
579+
594580
<head>To do:</head>
595581
</tag>
596582
<tag>
597583
<name>cdk.license</name>
598584
<placement>a</placement>
585+
599586
<head>License:</head>
600587
</tag>
601588
</tags>
@@ -755,8 +742,7 @@
755742
<version>RELEASE</version>
756743
</plugin>
757744
</plugins>
758-
</reporting>
759-
745+
</reporting>
760746
<profiles>
761747
<profile>
762748
<id>slow-tests</id>
@@ -847,12 +833,11 @@
847833
</build>
848834
</profile>
849835
</profiles>
850-
851836
<dependencies>
852837
<dependency>
853838
<groupId>junit</groupId>
854839
<artifactId>junit</artifactId>
855840
<scope>test</scope>
856841
</dependency>
857842
</dependencies>
858-
</project>
843+
</project>

storage/pdb/src/main/java/org/openscience/cdk/templates/AminoAcids.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public synchronized static AminoAcid[] createAAs() {
153153
aminoAcid.setProperty(RESIDUE_NAME_SHORT, ac.getProperty(dictRef));
154154
} else if (dictRef.getType().equals("pdb:id")) {
155155
aminoAcid.setProperty(ID, ac.getProperty(dictRef));
156-
LOGGER.debug("Set AA ID to: ", ac.getProperty(dictRef));
156+
LOGGER.debug("Set AA ID to: " + ac.getProperty(dictRef));
157157
} else {
158158
LOGGER.error("Cannot deal with dictRef!");
159159
}

tool/formula/src/test/java/org/openscience/cdk/formula/MolecularFormulaCheckerTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ public void testIsValid_NOT() {
122122

123123
IMolecularFormula formulaWith = MFChecker.isValid(formula);
124124

125-
Assert.assertEquals(0.0, formulaWith.getProperty((new MMElementRule()).getClass()));
125+
Assert.assertEquals(0.0d,
126+
(double)formulaWith.getProperty((new MMElementRule()).getClass()),
127+
0.01);
126128

127129
}
128130

@@ -170,8 +172,8 @@ public void testIsValid_NOT_2Rules() {
170172

171173
IMolecularFormula formulaWith = MFChecker.isValid(formula);
172174

173-
Assert.assertEquals(0.0, formulaWith.getProperty((new MMElementRule()).getClass()));
174-
Assert.assertEquals(1.0, formulaWith.getProperty((new ChargeRule()).getClass()));
175+
Assert.assertEquals(0.0, formulaWith.getProperty((new MMElementRule()).getClass()), 0.01);
176+
Assert.assertEquals(1.0, formulaWith.getProperty((new ChargeRule()).getClass()), 0.01);
175177

176178
}
177179

@@ -219,8 +221,8 @@ public void testIsValid_True_2Rules() {
219221

220222
IMolecularFormula formulaWith = MFChecker.isValid(formula);
221223

222-
Assert.assertEquals(1.0, formulaWith.getProperty((new MMElementRule()).getClass()));
223-
Assert.assertEquals(1.0, formulaWith.getProperty((new ChargeRule()).getClass()));
224+
Assert.assertEquals(1.0, formulaWith.getProperty((new MMElementRule()).getClass()), 0.01);
225+
Assert.assertEquals(1.0, formulaWith.getProperty((new ChargeRule()).getClass()), 0.01);
224226

225227
}
226228
}

0 commit comments

Comments
 (0)