Skip to content

Add support to build/run on Java 10 #639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

fmbenhassine
Copy link
Contributor

@fmbenhassine fmbenhassine commented Sep 12, 2018

This PR upgrades mockito to version 2.21.0. This upgrade is required to be able to test against Java 10.

Resolves BATCH-2756 and must be merged after #638 .

1. The first issue is:

```
> Task :api
DefaultBatchConfigurer.java:18: error: cannot find symbol
import javax.annotation.PostConstruct;
                       ^
  symbol:   class PostConstruct
  location: package javax.annotation
DataSourceConfiguration.java:18: error: cannot find symbol
import javax.annotation.PostConstruct;
                       ^
  symbol:   class PostConstruct
  location: package javax.annotation
DefaultBatchConfigurer.java:94: error: cannot find symbol
        @PostConstruct
         ^
  symbol:   class PostConstruct
  location: class DefaultBatchConfigurer
DataSourceConfiguration.java:46: error: cannot find symbol
        @PostConstruct
         ^
  symbol:   class PostConstruct
  location: class DataSourceConfiguration
4 errors
```

This issue is fixed by adding the `javax.annotation-api` dependency

2. The second issue is:

```
javadoc: error - An internal exception has occurred.
(com.sun.tools.javac.code.ClassFinder$BadClassFile: bad class file:
/org/springframework/batch/core/configuration/support/
GenericApplicationContextFactory$ResourceAnnotationApplicationContext$1.class

class file contains malformed variable arity method:
GenericApplicationContextFactory$ResourceAnnotationApplicationContext$1
Please remove or make sure it appears in the correct subdirectory of the classpath.)
```

The workaround to this issue is to use a named inner class instead of
an anonymous one.

JIRA: BATCH-2751
* `javax.xml.bind` is no longer contained in the default class path in
Java SE 9. This commit adds the module `java.xml.bind` to the JVM args
for tests

* JsrBeanDefinitionDocumentReaderTests are failing because
`ClassLoader.class.getResourceAsStream` has a different behaviour on Java 9.
According to `https://stackoverflow.com/a/45173837/5019386`, it's best to
use the resource-lookup methods in Class rather than those in ClassLoader.

* DefaultJobParametersExtractorJobParametersTests#testGetAllJobParameters
is failing because jobParameters.toString() returns "{foo=bar, spam=bucket}"
on Java 9 and "{spam=bucket, foo=bar}" on Java 8. The fix asserts that
jobParameters contains the expected key/value pairs without relying on the
toString method

JIRA: BATCH-2751
This upgrade is required to be able to test against Java 10

Issue: BATCH-2756
@fmbenhassine fmbenhassine changed the title Upgrade mockito to version 2.21.0 Add support to build/run on Java 10 Sep 12, 2018
@fmbenhassine
Copy link
Contributor Author

This PR is not relevant anymore: changes added here have been already merged in the master branch via #638 and #642 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant