Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.

Commit aa5ccec

Browse files
committed
A first attempt at creating real JDK 9 modules when building with JDK 9.
1 parent 93455ca commit aa5ccec

11 files changed

Lines changed: 470 additions & 58 deletions

File tree

android/activation/pom.xml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,23 @@
113113
<target>1.7</target>
114114
<fork>true</fork>
115115
<!--
116-
ignore some of the errors that are
117-
too hard to fix for now
116+
ignore the errors that I don't
117+
want to fix now
118118
-->
119-
<!--
120-
<compilerArguments>
121-
<Xlint:all/>
122-
<Xlint:-rawtypes/>
123-
<Xlint:-unchecked/>
124-
<Xlint:-finally/>
125-
</compilerArguments>
119+
<compilerArgs>
120+
<arg>-Xlint</arg>
121+
<arg>-Xlint:-options</arg>
122+
<arg>-Xlint:-path</arg>
123+
<arg>-Xlint:-rawtypes</arg>
124+
<arg>-Xlint:-unchecked</arg>
125+
<arg>-Xlint:-finally</arg>
126+
<arg>-Xlint:-serial</arg>
127+
<arg>-Xlint:-cast</arg>
128+
<arg>-Xlint:-deprecation</arg>
129+
<arg>-Xlint:-dep-ann</arg>
130+
<arg>-Werror</arg>
131+
</compilerArgs>
126132
<showWarnings>true</showWarnings>
127-
-->
128133
</configuration>
129134
</execution>
130135
<execution>

android/pom.xml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
55
6-
Copyright (c) 1997-2017 Oracle and/or its affiliates. All rights reserved.
6+
Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved.
77
88
The contents of this file are subject to the terms of either the GNU
99
General Public License Version 2 only ("GPL") or the Common Development
@@ -76,27 +76,6 @@
7676
<android.version>4.4_r1</android.version>
7777
</properties>
7878

79-
<profiles>
80-
<!--
81-
A special profile for compiling with JDK 9.
82-
Skip animal-sniffer until it works with JDK 9.
83-
-->
84-
<profile>
85-
<id>9</id>
86-
<build>
87-
<plugins>
88-
<plugin>
89-
<groupId>org.codehaus.mojo</groupId>
90-
<artifactId>animal-sniffer-maven-plugin</artifactId>
91-
<configuration>
92-
<skip>true</skip>
93-
</configuration>
94-
</plugin>
95-
</plugins>
96-
</build>
97-
</profile>
98-
</profiles>
99-
10079
<build>
10180
<plugins>
10281
<plugin>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3+
*
4+
* Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
5+
*
6+
* The contents of this file are subject to the terms of either the GNU
7+
* General Public License Version 2 only ("GPL") or the Common Development
8+
* and Distribution License("CDDL") (collectively, the "License"). You
9+
* may not use this file except in compliance with the License. You can
10+
* obtain a copy of the License at
11+
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
12+
* or LICENSE.txt. See the License for the specific
13+
* language governing permissions and limitations under the License.
14+
*
15+
* When distributing the software, include this License Header Notice in each
16+
* file and include the License file at LICENSE.txt.
17+
*
18+
* GPL Classpath Exception:
19+
* Oracle designates this particular file as subject to the "Classpath"
20+
* exception as provided by Oracle in the GPL Version 2 section of the License
21+
* file that accompanied this code.
22+
*
23+
* Modifications:
24+
* If applicable, add the following below the License Header, with the fields
25+
* enclosed by brackets [] replaced by your own identifying information:
26+
* "Portions Copyright [year] [name of copyright owner]"
27+
*
28+
* Contributor(s):
29+
* If you wish your version of this file to be governed by only the CDDL or
30+
* only the GPL Version 2, indicate your decision by adding "[Contributor]
31+
* elects to include this software in this distribution under the [CDDL or GPL
32+
* Version 2] license." If you don't indicate a single choice of license, a
33+
* recipient has the option to distribute your version of this file under
34+
* either the CDDL, the GPL Version 2 or to extend the choice of license to
35+
* its licensees as provided above. However, if you add GPL Version 2 code
36+
* and therefore, elected the GPL Version 2 license, then the option applies
37+
* only if the new code is made subject to such option by the copyright
38+
* holder.
39+
*/
40+
41+
module com.sun.mail.imap {
42+
exports com.sun.mail.iap;
43+
exports com.sun.mail.imap;
44+
exports com.sun.mail.imap.protocol;
45+
46+
requires java.mail;
47+
requires java.logging;
48+
requires java.security.sasl;
49+
}

mail/pom.xml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
55
6-
Copyright (c) 1997-2017 Oracle and/or its affiliates. All rights reserved.
6+
Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved.
77
88
The contents of this file are subject to the terms of either the GNU
99
General Public License Version 2 only ("GPL") or the Common Development
@@ -127,10 +127,15 @@
127127
</profile>
128128

129129
<!--
130-
A special profile for compiling with the real JDK 9 compiler.
130+
A special profile used when compiling with the real JDK 9 compiler.
131+
Override the release setting from the parent's "9" profile so
132+
that we produce JDK 1.7 compatible class files.
131133
-->
132134
<profile>
133135
<id>9</id>
136+
<activation>
137+
<jdk>9</jdk>
138+
</activation>
134139
<build>
135140
<plugins>
136141
<plugin>
@@ -139,15 +144,7 @@
139144
<execution>
140145
<id>default-compile</id>
141146
<configuration>
142-
<compilerArgs>
143-
<arg>-Xlint</arg>
144-
<arg>-Xlint:-options</arg>
145-
<arg>-Xlint:-path</arg>
146-
<!--
147-
Too many finalize warnings.
148-
<arg>-Werror</arg>
149-
-->
150-
</compilerArgs>
147+
<release combine.self="override"></release>
151148
</configuration>
152149
</execution>
153150
</executions>

mailapi/pom.xml

Lines changed: 107 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
55
6-
Copyright (c) 1997-2017 Oracle and/or its affiliates. All rights reserved.
6+
Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved.
77
88
The contents of this file are subject to the terms of either the GNU
99
General Public License Version 2 only ("GPL") or the Common Development
@@ -67,16 +67,115 @@
6767
<properties>
6868
<mail.packages.export>
6969
javax.mail.*; version=${mail.spec.version},
70-
com.sun.mail.util; version=${mail.version},
71-
com.sun.mail.util.logging; version=${mail.version},
72-
com.sun.mail.auth; version=${mail.version}
73-
com.sun.mail.handlers; version=${mail.version}
70+
com.sun.mail.util; version=${mail.osgiversion},
71+
com.sun.mail.auth; version=${mail.osgiversion},
72+
com.sun.mail.handlers; version=${mail.osgiversion}
7473
</mail.packages.export>
7574
<mail.bundle.symbolicName>
7675
javax.mail.api
7776
</mail.bundle.symbolicName>
7877
</properties>
7978

79+
<profiles>
80+
<!--
81+
A special profile for compiling with the real JDK 1.7 compiler.
82+
Exclude MailSessionDefinition and MailSessionDefinitions since
83+
the former requires JDK 1.8 and the latter depends on the former.
84+
-->
85+
<profile>
86+
<id>1.7</id>
87+
<build>
88+
<plugins>
89+
<plugin>
90+
<artifactId>maven-compiler-plugin</artifactId>
91+
<executions>
92+
<execution>
93+
<id>default-compile</id>
94+
<configuration>
95+
<excludes>
96+
<exclude>
97+
javax/mail/MailSessionDefinition.java
98+
</exclude>
99+
<exclude>
100+
javax/mail/MailSessionDefinitions.java
101+
</exclude>
102+
<exclude>
103+
module-info.java
104+
</exclude>
105+
</excludes>
106+
</configuration>
107+
</execution>
108+
</executions>
109+
</plugin>
110+
</plugins>
111+
</build>
112+
</profile>
113+
114+
<!--
115+
A special profile for compiling with JDK 9.
116+
-->
117+
<profile>
118+
<id>9</id>
119+
<activation>
120+
<jdk>9</jdk>
121+
</activation>
122+
<build>
123+
<plugins>
124+
<plugin>
125+
<artifactId>maven-compiler-plugin</artifactId>
126+
<executions>
127+
<execution>
128+
<id>default-compile</id>
129+
<configuration>
130+
<release>9</release>
131+
<source>9</source>
132+
<target>9</target>
133+
<compilerArgs>
134+
<arg>-Xlint</arg>
135+
<arg>-Xlint:-options</arg>
136+
<arg>-Xlint:-path</arg>
137+
<!--
138+
Too many finalize warnings.
139+
<arg>-Werror</arg>
140+
-->
141+
</compilerArgs>
142+
<!-- un-exclude module-info.java -->
143+
<excludes combine.self="override">
144+
</excludes>
145+
</configuration>
146+
</execution>
147+
</executions>
148+
</plugin>
149+
<!--
150+
Require JDK 9.
151+
-->
152+
<plugin>
153+
<groupId>org.apache.maven.plugins</groupId>
154+
<artifactId>maven-enforcer-plugin</artifactId>
155+
<executions>
156+
<execution>
157+
<id>enforce-version</id>
158+
<goals>
159+
<goal>enforce</goal>
160+
</goals>
161+
<configuration>
162+
<rules>
163+
<requireMavenVersion>
164+
<version>[3.0.3,)</version>
165+
</requireMavenVersion>
166+
<requireJavaVersion>
167+
<version>9</version>
168+
</requireJavaVersion>
169+
</rules>
170+
</configuration>
171+
</execution>
172+
</executions>
173+
</plugin>
174+
</plugins>
175+
</build>
176+
</profile>
177+
</profiles>
178+
80179
<build>
81180
<plugins>
82181
<plugin>
@@ -85,15 +184,15 @@
85184
<execution>
86185
<!-- download the binaries -->
87186
<id>get-binaries</id>
88-
<phase>compile</phase>
187+
<phase>generate-sources</phase>
89188
<goals>
90189
<goal>unpack</goal>
91190
</goals>
92191
</execution>
93192
<execution>
94193
<!-- download the sources -->
95194
<id>get-sources</id>
96-
<phase>compile</phase>
195+
<phase>generate-sources</phase>
97196
<goals>
98197
<goal>unpack</goal>
99198
</goals>
@@ -131,6 +230,7 @@
131230
META-INF/*
132231
</includes>
133232
<excludes>
233+
com/sun/mail/util/logging/**,
134234
META-INF/javamail.default.*
135235
</excludes>
136236
</configuration>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3+
*
4+
* Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
5+
*
6+
* The contents of this file are subject to the terms of either the GNU
7+
* General Public License Version 2 only ("GPL") or the Common Development
8+
* and Distribution License("CDDL") (collectively, the "License"). You
9+
* may not use this file except in compliance with the License. You can
10+
* obtain a copy of the License at
11+
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
12+
* or LICENSE.txt. See the License for the specific
13+
* language governing permissions and limitations under the License.
14+
*
15+
* When distributing the software, include this License Header Notice in each
16+
* file and include the License file at LICENSE.txt.
17+
*
18+
* GPL Classpath Exception:
19+
* Oracle designates this particular file as subject to the "Classpath"
20+
* exception as provided by Oracle in the GPL Version 2 section of the License
21+
* file that accompanied this code.
22+
*
23+
* Modifications:
24+
* If applicable, add the following below the License Header, with the fields
25+
* enclosed by brackets [] replaced by your own identifying information:
26+
* "Portions Copyright [year] [name of copyright owner]"
27+
*
28+
* Contributor(s):
29+
* If you wish your version of this file to be governed by only the CDDL or
30+
* only the GPL Version 2, indicate your decision by adding "[Contributor]
31+
* elects to include this software in this distribution under the [CDDL or GPL
32+
* Version 2] license." If you don't indicate a single choice of license, a
33+
* recipient has the option to distribute your version of this file under
34+
* either the CDDL, the GPL Version 2 or to extend the choice of license to
35+
* its licensees as provided above. However, if you add GPL Version 2 code
36+
* and therefore, elected the GPL Version 2 license, then the option applies
37+
* only if the new code is made subject to such option by the copyright
38+
* holder.
39+
*/
40+
41+
module java.mail {
42+
exports javax.mail;
43+
exports javax.mail.event;
44+
exports javax.mail.internet;
45+
exports javax.mail.search;
46+
exports javax.mail.util;
47+
exports com.sun.mail.util;
48+
exports com.sun.mail.auth;
49+
exports com.sun.mail.handlers;
50+
51+
requires transitive java.activation;
52+
requires java.logging;
53+
}

0 commit comments

Comments
 (0)