From 3cc2298df04c379a76339eb88eea2e44d905e6fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9da=20Housni=20Alaoui?= Date: Tue, 13 Mar 2018 20:26:35 +0100 Subject: [PATCH 1/5] Java 9: requiring elasticsearch from module-info.java fails --- .../java/org/apache/lucene/codecs/JigsawMarker.java | 11 +++++++++++ .../lucene/search/suggest/document/JigsawMarker.java | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 server/src/main/java/org/apache/lucene/codecs/JigsawMarker.java create mode 100644 server/src/main/java/org/apache/lucene/search/suggest/document/JigsawMarker.java diff --git a/server/src/main/java/org/apache/lucene/codecs/JigsawMarker.java b/server/src/main/java/org/apache/lucene/codecs/JigsawMarker.java new file mode 100644 index 0000000000000..a296656638ae5 --- /dev/null +++ b/server/src/main/java/org/apache/lucene/codecs/JigsawMarker.java @@ -0,0 +1,11 @@ +package org.apache.lucene.codecs; + +/** + * This marker is needed because Java 9 compiler expects the current package to contains at least one class during automodule descriptor derivation process. + *

+ * Created on 13/03/18. + * + * @author Reda.Housni-Alaoui + */ +interface JigsawMarker { +} diff --git a/server/src/main/java/org/apache/lucene/search/suggest/document/JigsawMarker.java b/server/src/main/java/org/apache/lucene/search/suggest/document/JigsawMarker.java new file mode 100644 index 0000000000000..e964da1dcbe79 --- /dev/null +++ b/server/src/main/java/org/apache/lucene/search/suggest/document/JigsawMarker.java @@ -0,0 +1,11 @@ +package org.apache.lucene.search.suggest.document; + +/** + * This marker is needed because Java 9 compiler expects the current package to contains at least one class during automodule descriptor derivation process. + *

+ * Created on 13/03/18. + * + * @author Reda.Housni-Alaoui + */ +interface JigsawMarker { +} From bc1497d0c768718dcbb0320cd3aa8be558ef5e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9da=20Housni=20Alaoui?= Date: Tue, 13 Mar 2018 20:34:00 +0100 Subject: [PATCH 2/5] Fix classes headers --- .../apache/lucene/codecs/JigsawMarker.java | 25 +++++++++++++++---- .../search/suggest/document/JigsawMarker.java | 25 +++++++++++++++---- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/server/src/main/java/org/apache/lucene/codecs/JigsawMarker.java b/server/src/main/java/org/apache/lucene/codecs/JigsawMarker.java index a296656638ae5..ba47ee67689e6 100644 --- a/server/src/main/java/org/apache/lucene/codecs/JigsawMarker.java +++ b/server/src/main/java/org/apache/lucene/codecs/JigsawMarker.java @@ -1,11 +1,26 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.lucene.codecs; /** - * This marker is needed because Java 9 compiler expects the current package to contains at least one class during automodule descriptor derivation process. - *

- * Created on 13/03/18. - * - * @author Reda.Housni-Alaoui + * This marker is needed because Java 9 compiler expects the current package to contain at least one class during + * automodule descriptor derivation process. */ interface JigsawMarker { } diff --git a/server/src/main/java/org/apache/lucene/search/suggest/document/JigsawMarker.java b/server/src/main/java/org/apache/lucene/search/suggest/document/JigsawMarker.java index e964da1dcbe79..aa0e0dcb5932d 100644 --- a/server/src/main/java/org/apache/lucene/search/suggest/document/JigsawMarker.java +++ b/server/src/main/java/org/apache/lucene/search/suggest/document/JigsawMarker.java @@ -1,11 +1,26 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.lucene.search.suggest.document; /** - * This marker is needed because Java 9 compiler expects the current package to contains at least one class during automodule descriptor derivation process. - *

- * Created on 13/03/18. - * - * @author Reda.Housni-Alaoui + * This marker is needed because Java 9 compiler expects the current package to contain at least one class during + * automodule descriptor derivation process. */ interface JigsawMarker { } From 71c5c32ea1b5ce5c053a0a1641fc280d6938360a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9da=20Housni=20Alaoui?= Date: Tue, 13 Mar 2018 22:52:50 +0100 Subject: [PATCH 3/5] Add test module --- settings.gradle | 3 +- test/jigsaw-consumer/build.gradle | 44 +++++++++++++++++++ .../src/main/java/module-info.java | 21 +++++++++ .../test/jigsaw_consumer/Foo.java | 14 ++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 test/jigsaw-consumer/build.gradle create mode 100644 test/jigsaw-consumer/src/main/java/module-info.java create mode 100644 test/jigsaw-consumer/src/main/java/org/elasticsearch/test/jigsaw_consumer/Foo.java diff --git a/settings.gradle b/settings.gradle index 420b4104d621d..4fd810f042e3a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -33,7 +33,8 @@ List projects = [ 'test:fixtures:hdfs-fixture', 'test:fixtures:krb5kdc-fixture', 'test:fixtures:old-elasticsearch', - 'test:logger-usage' + 'test:logger-usage', + 'test:jigsaw-consumer' ] /** diff --git a/test/jigsaw-consumer/build.gradle b/test/jigsaw-consumer/build.gradle new file mode 100644 index 0000000000000..568dfe8ea4a04 --- /dev/null +++ b/test/jigsaw-consumer/build.gradle @@ -0,0 +1,44 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +apply plugin: 'elasticsearch.build' + +sourceCompatibility = JavaVersion.VERSION_1_9 +targetCompatibility = JavaVersion.VERSION_1_9 + +configurations.all { + transitive = false +} + +dependencies { + compile "org.elasticsearch:elasticsearch:${version}" +} + +ext.moduleName = 'jigsaw_consumer' + +compileJava { + inputs.property("moduleName", moduleName) + doFirst { + options.compilerArgs = [ + '--module-path', classpath.asPath, + '-sourcepath', 'src/main/java' + ] + classpath = files() + } +} \ No newline at end of file diff --git a/test/jigsaw-consumer/src/main/java/module-info.java b/test/jigsaw-consumer/src/main/java/module-info.java new file mode 100644 index 0000000000000..ca556aba13feb --- /dev/null +++ b/test/jigsaw-consumer/src/main/java/module-info.java @@ -0,0 +1,21 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +module jigsaw_consumer { + requires elasticsearch; +} diff --git a/test/jigsaw-consumer/src/main/java/org/elasticsearch/test/jigsaw_consumer/Foo.java b/test/jigsaw-consumer/src/main/java/org/elasticsearch/test/jigsaw_consumer/Foo.java new file mode 100644 index 0000000000000..c886d9ee5ed7a --- /dev/null +++ b/test/jigsaw-consumer/src/main/java/org/elasticsearch/test/jigsaw_consumer/Foo.java @@ -0,0 +1,14 @@ +package org.elasticsearch.test.jigsaw_consumer; + +import org.elasticsearch.client.Client; + +/** + * Created on 13/03/18. + * + * @author Reda.Housni-Alaoui + */ +public interface Foo { + + Client client(); + +} From e4cac84d72413d1abfaa0b975d8f0b6959310db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9da=20Housni=20Alaoui?= Date: Tue, 13 Mar 2018 22:54:56 +0100 Subject: [PATCH 4/5] Add test module --- .../test/jigsaw_consumer/Foo.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/test/jigsaw-consumer/src/main/java/org/elasticsearch/test/jigsaw_consumer/Foo.java b/test/jigsaw-consumer/src/main/java/org/elasticsearch/test/jigsaw_consumer/Foo.java index c886d9ee5ed7a..7c5a5d5069f24 100644 --- a/test/jigsaw-consumer/src/main/java/org/elasticsearch/test/jigsaw_consumer/Foo.java +++ b/test/jigsaw-consumer/src/main/java/org/elasticsearch/test/jigsaw_consumer/Foo.java @@ -1,12 +1,25 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.elasticsearch.test.jigsaw_consumer; import org.elasticsearch.client.Client; -/** - * Created on 13/03/18. - * - * @author Reda.Housni-Alaoui - */ public interface Foo { Client client(); From e0ec871a7d9e94b0c8a88479b5561ef812a187d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9da=20Housni=20Alaoui?= Date: Wed, 14 Mar 2018 17:35:09 +0100 Subject: [PATCH 5/5] Remove empty descriptors --- .../resources/META-INF/services/org.apache.lucene.codecs.Codec | 0 .../META-INF/services/org.apache.lucene.codecs.DocValuesFormat | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 server/src/main/resources/META-INF/services/org.apache.lucene.codecs.Codec delete mode 100644 server/src/main/resources/META-INF/services/org.apache.lucene.codecs.DocValuesFormat diff --git a/server/src/main/resources/META-INF/services/org.apache.lucene.codecs.Codec b/server/src/main/resources/META-INF/services/org.apache.lucene.codecs.Codec deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/server/src/main/resources/META-INF/services/org.apache.lucene.codecs.DocValuesFormat b/server/src/main/resources/META-INF/services/org.apache.lucene.codecs.DocValuesFormat deleted file mode 100644 index e69de29bb2d1d..0000000000000