- Notifications
You must be signed in to change notification settings - Fork427
feat: support Java Platform Module System#618
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Draft
alaahong wants to merge4 commits intoapache:mainChoose a base branch fromalaahong:feature/java_module
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Draft
Changes fromall commits
Commits
Show all changes
4 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
75 changes: 75 additions & 0 deletionsfesod/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletionsfesod/src/main/java9/module-info.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF 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. | ||
*/ | ||
open module org.apache.fesod { | ||
requires java.base; | ||
requires java.logging; | ||
requires java.xml; | ||
requires java.sql; | ||
requires org.apache.commons.collections4; | ||
requires org.apache.commons.compress; | ||
requires org.apache.commons.csv; | ||
requires org.apache.commons.io; | ||
requires org.apache.poi.ooxml; | ||
requires org.apache.poi.ooxml.schemas; | ||
requires org.apache.poi.poi; | ||
requires org.apache.xmlbeans; | ||
requires fastexcel.support; | ||
requires ehcache; | ||
requires org.slf4j; | ||
requires static lombok; | ||
exports org.apache.fesod.excel; | ||
exports org.apache.fesod.excel.analysis; | ||
exports org.apache.fesod.excel.analysis.csv; | ||
exports org.apache.fesod.excel.analysis.v03; | ||
exports org.apache.fesod.excel.analysis.v03.handlers; | ||
exports org.apache.fesod.excel.analysis.v07; | ||
exports org.apache.fesod.excel.analysis.v07.handlers; | ||
exports org.apache.fesod.excel.analysis.v07.handlers.sax; | ||
exports org.apache.fesod.excel.annotation; | ||
exports org.apache.fesod.excel.annotation.format; | ||
exports org.apache.fesod.excel.annotation.write.style; | ||
exports org.apache.fesod.excel.cache; | ||
exports org.apache.fesod.excel.cache.selector; | ||
exports org.apache.fesod.excel.constant; | ||
exports org.apache.fesod.excel.context; | ||
exports org.apache.fesod.excel.context.csv; | ||
exports org.apache.fesod.excel.context.xls; | ||
exports org.apache.fesod.excel.context.xlsx; | ||
exports org.apache.fesod.excel.converters; | ||
exports org.apache.fesod.excel.converters.bigdecimal; | ||
exports org.apache.fesod.excel.converters.biginteger; | ||
exports org.apache.fesod.excel.converters.booleanconverter; | ||
exports org.apache.fesod.excel.converters.bytearray; | ||
exports org.apache.fesod.excel.converters.byteconverter; | ||
exports org.apache.fesod.excel.converters.date; | ||
exports org.apache.fesod.excel.converters.doubleconverter; | ||
exports org.apache.fesod.excel.converters.file; | ||
exports org.apache.fesod.excel.converters.floatconverter; | ||
exports org.apache.fesod.excel.converters.inputstream; | ||
exports org.apache.fesod.excel.converters.integer; | ||
exports org.apache.fesod.excel.converters.localdate; | ||
exports org.apache.fesod.excel.converters.localdatetime; | ||
exports org.apache.fesod.excel.converters.longconverter; | ||
exports org.apache.fesod.excel.converters.shortconverter; | ||
exports org.apache.fesod.excel.converters.string; | ||
exports org.apache.fesod.excel.converters.url; | ||
exports org.apache.fesod.excel.enums; | ||
exports org.apache.fesod.excel.enums.poi; | ||
exports org.apache.fesod.excel.event; | ||
exports org.apache.fesod.excel.exception; | ||
exports org.apache.fesod.excel.metadata; | ||
exports org.apache.fesod.excel.metadata.csv; | ||
exports org.apache.fesod.excel.metadata.data; | ||
exports org.apache.fesod.excel.metadata.format; | ||
exports org.apache.fesod.excel.metadata.property; | ||
exports org.apache.fesod.excel.read.builder; | ||
exports org.apache.fesod.excel.read.listener; | ||
exports org.apache.fesod.excel.read.metadata; | ||
exports org.apache.fesod.excel.read.metadata.holder; | ||
exports org.apache.fesod.excel.read.metadata.holder.csv; | ||
exports org.apache.fesod.excel.read.metadata.holder.xls; | ||
exports org.apache.fesod.excel.read.metadata.holder.xlsx; | ||
exports org.apache.fesod.excel.read.metadata.property; | ||
exports org.apache.fesod.excel.read.processor; | ||
exports org.apache.fesod.excel.support; | ||
exports org.apache.fesod.excel.util; | ||
exports org.apache.fesod.excel.write; | ||
exports org.apache.fesod.excel.write.builder; | ||
exports org.apache.fesod.excel.write.executor; | ||
exports org.apache.fesod.excel.write.handler; | ||
exports org.apache.fesod.excel.write.handler.chain; | ||
exports org.apache.fesod.excel.write.handler.context; | ||
exports org.apache.fesod.excel.write.handler.impl; | ||
exports org.apache.fesod.excel.write.merge; | ||
exports org.apache.fesod.excel.write.metadata; | ||
exports org.apache.fesod.excel.write.metadata.fill; | ||
exports org.apache.fesod.excel.write.metadata.holder; | ||
exports org.apache.fesod.excel.write.metadata.style; | ||
exports org.apache.fesod.excel.write.property; | ||
exports org.apache.fesod.excel.write.style; | ||
exports org.apache.fesod.excel.write.style.column; | ||
exports org.apache.fesod.excel.write.style.row; | ||
} |
38 changes: 38 additions & 0 deletionsfesod/src/test/java/org/apache/fesod/excel/module/ModuleDefinitionTestPlaceholder.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF 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.fesod.excel.module; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.DisabledForJreRange; | ||
import org.junit.jupiter.api.condition.JRE; | ||
/** | ||
* Placeholder to keep Java 8 test compilation green. The real module descriptor test | ||
* (requiring Java 9+) lives under src/test/java9 with class name {@code ModuleDefinitionTest}. | ||
* Disabled for all JRE >= 9 via @DisabledForJreRange to remain future-proof. | ||
*/ | ||
@DisabledForJreRange(min = JRE.JAVA_9) | ||
class ModuleDefinitionTestPlaceholder { | ||
@Test | ||
void noop() { | ||
// Intentionally empty. | ||
} | ||
} |
73 changes: 65 additions & 8 deletionsfesod/src/test/java/org/apache/fesod/excel/util/TestFileUtil.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -21,26 +21,31 @@ | ||
import java.io.File; | ||
import java.io.InputStream; | ||
import java.net.URL; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Objects; | ||
import org.apache.commons.collections4.CollectionUtils; | ||
public class TestFileUtil { | ||
public static InputStream getResourcesFileInputStream(String fileName) { | ||
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); | ||
return contextClassLoader == null ? null : contextClassLoader.getResourceAsStream(fileName); | ||
} | ||
public static String getPath() { | ||
returnresolveRootPath(); | ||
} | ||
public static TestPathBuild pathBuild() { | ||
return new TestPathBuild(); | ||
} | ||
public static File createNewFile(String pathName) { | ||
File file =pathFromRoot(pathName).toFile(); | ||
if (file.exists()) { | ||
file.delete(); | ||
} else { | ||
@@ -52,7 +57,7 @@ public static File createNewFile(String pathName) { | ||
} | ||
public static File readFile(String pathName) { | ||
returnpathFromRoot(pathName).toFile(); | ||
} | ||
public static File readUserHomeFile(String pathName) { | ||
@@ -75,19 +80,71 @@ public TestPathBuild sub(String dirOrFile) { | ||
} | ||
public String getPath() { | ||
String rootPath = resolveRootPath(); | ||
if (CollectionUtils.isEmpty(subPath)) { | ||
returnrootPath; | ||
} | ||
if (subPath.size() == 1) { | ||
returnrootPath + subPath.get(0); | ||
} | ||
StringBuilder path = new StringBuilder(rootPath); | ||
path.append(subPath.get(0)); | ||
for (int i = 1; i < subPath.size(); i++) { | ||
path.append(File.separator).append(subPath.get(i)); | ||
} | ||
return path.toString(); | ||
} | ||
} | ||
private static String resolveRootPath() { | ||
Path codeSourceLocation = resolveFromCodeSource(); | ||
if (codeSourceLocation != null) { | ||
return appendSeparator(codeSourceLocation.toString()); | ||
} | ||
URL resource = null; | ||
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); | ||
if (contextClassLoader != null) { | ||
resource = contextClassLoader.getResource(""); | ||
} | ||
if (resource == null) { | ||
resource = TestFileUtil.class.getResource("/"); | ||
} | ||
URL finalResource = Objects.requireNonNull(resource, "Unable to locate test resources root"); | ||
String path = finalResource.getPath(); | ||
if ("file".equals(finalResource.getProtocol())) { | ||
if (path.startsWith("file:")) { | ||
path = path.substring("file:".length()); | ||
} | ||
alaahong marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
} | ||
return appendSeparator(path); | ||
} | ||
private static Path pathFromRoot(String relativePath) { | ||
return Paths.get(resolveRootPath(), relativePath); | ||
} | ||
private static Path resolveFromCodeSource() { | ||
try { | ||
if (TestFileUtil.class.getProtectionDomain() == null | ||
|| TestFileUtil.class.getProtectionDomain().getCodeSource() == null) { | ||
return null; | ||
} | ||
Path location = Paths.get(TestFileUtil.class | ||
.getProtectionDomain() | ||
.getCodeSource() | ||
.getLocation() | ||
.toURI()); | ||
if (!location.toFile().isDirectory()) { | ||
return null; | ||
} | ||
return location; | ||
} catch (Exception ex) { | ||
return null; | ||
} | ||
} | ||
private static String appendSeparator(String path) { | ||
return path.endsWith(File.separator) ? path : path + File.separator; | ||
} | ||
} |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.