module-info

How do Java Module directives impact reflection access into a module?

橙三吉。 提交于 2021-02-18 07:37:05
问题 According to https://www.oracle.com/corporate/features/understanding-java-9-modules.html, the Java Module system introduces the following directives: exports, exports ... to uses provides ... with open, opens, opens ... to What (if any) impact does each directive have on an external module accessing internal members using reflection? For example, does exports <package> allow external modules to access all public , protected , private members of the exported package using reflection? What

Java 11 : Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile failed.: NullPointerException

放肆的年华 提交于 2021-02-04 19:51:29
问题 I am upgrading my project from java 8 to java 11. I'm able to build and deploy it with java11, spring 5 dependencies but when I am adding module-info.java into my project I am getting below error while build : [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project infrastructure: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile failed.: NullPointerException -> [Help 1] org.apache

Java: Is `sun.awt.image` package deprecated?

这一生的挚爱 提交于 2020-06-25 21:12:17
问题 I was wanting to use some codes that using sun.awt.image.PNGImageDecoder in my project. The problem is source code is based on Java 8 and my project using JDK 9+ (11). So I got this error: Package ' sun.awt.image ' is declared in module ' java.desktop ', which does not export it to the unnamed module . for import sun.awt.image.* , and: Symbol is declared in module ' java.desktop ' which does not export package ' sun.awt.image ' for using PNGImageDecoder or ImageDecoder etc. After some efforts

Is it possible to use SharedSecrets across Java modules?

主宰稳场 提交于 2020-05-15 04:10:41
问题 Given: Modules A and B , where B imports A . Module A exports external.class1 . It defines but does not export external.class1.secretProvider , internal.SharedSecrets and internal.class2 (more on these below). Module A uses the SharedSecrets mechanism to grant external.class1 access to private methods in internal.class2 using external.class1.secretProvider . I wish to grant external.class3 (defined in Module B ) access to private methods in internal.class2 but seeing as internal.SharedSecrets

Error with package com.sun.glass.ui while learning Java Native Access

梦想的初衷 提交于 2020-01-24 19:24:38
问题 I am trying to use an Undecorated stage in a JavaFX project, stage.initStyle(StageStyle.UNDECORATED); . It is a modular Gradle project. It is also a multi-project build, though because I am working on it in IntelliJ, it might be more appropriate to refer to it as a multi-module build. I wish to be able to add regular functionality to this Undecorated stage. I have already been able to add the usual minimize, restore, and close buttons, but if a user clicks on the program's icon in the Windows

How to get Eclipse to stop asking to create a module-info java file on new Java project creation?

让人想犯罪 __ 提交于 2020-01-23 10:09:52
问题 Everytime I try to create a new java project Eclipse keeps asking if I want to add a module-info java file to the source folder. It's getting pretty annoying as there's no immediately obvious option to opt out of this check. IDE for Java Developers, Photon release 4.8.0 回答1: See while creating a new project, after you click>> next on the very first dialog "new java project." There is one another dialog box pops up when you click >> finish. It will lead you to the 3rd dialog box which asks for

How to get Eclipse to stop asking to create a module-info java file on new Java project creation?

家住魔仙堡 提交于 2020-01-23 10:08:57
问题 Everytime I try to create a new java project Eclipse keeps asking if I want to add a module-info java file to the source folder. It's getting pretty annoying as there's no immediately obvious option to opt out of this check. IDE for Java Developers, Photon release 4.8.0 回答1: See while creating a new project, after you click>> next on the very first dialog "new java project." There is one another dialog box pops up when you click >> finish. It will lead you to the 3rd dialog box which asks for

log4j2 configuration file not found with java 9

佐手、 提交于 2019-12-30 10:05:34
问题 I had a Java 8 project and my configuration file was in resource folder and everything worked fine. Now I switched to Java 9, added requirement for log4j.api , and configuration file cannot be found anymore. Do I need to add something else in my module-info file for the logger to find it's config? For now, it's like this module project.main { requires jdk.incubator.httpclient; requires jackson.databind; requires jackson.core; requires jackson.annotations; requires log4j.api; } The Project

What is an open module in Java 9 and how to use it

强颜欢笑 提交于 2019-12-30 03:43:11
问题 What is the difference between module with open keyword before and without it? For instance: open module foo { } module foo { } 回答1: In order to provide reflective access to your module, Java 9 introduced open keyword. You can create open module by using open keyword in module declaration. An open module grants reflective access to all of it's packages to other modules. For example, if you want to use some framework, that heavily relies on reflection, such as Spring, Hibernate etc, you can