Core Type Compilation Issues

David Holmes david.holmes at oracle.com
Tue Aug 7 01:44:34 UTC 2018


Hi Max,

I can give you some guidance but no quick fixes ...

On 7/08/2018 4:21 AM, mr rupplin wrote:
> Three problems that I run into when running the 'make jdk' after minor work on the System.java class for JNI and custom JDK:
> 
> java/lang/memory/GroupListener.java:111: warning: [rawtypes] found raw type: Class
>          Class basetype = null;

You are using a raw type - hence the warning. If you don't know what a 
raw type is then you need to do a refresher on Java's generic types. Fix 
is to not use a raw type e.g.:

Class<?> baseType = null;

but it will also depend on how baseType is used.

> java/lang/memory/GroupListener.java:7: error: package java.rmi does not exist
> import java.rmi.Remote;

In OpenJDK 9 you are using the new modular JDK. All of the core packages 
in java.lang are in the java.base module. The java.rmi package is in the 
java.rmi module. The base module, by design, can not have any 
dependencies on any other module - as all other modules implicitly 
depend on the base module. So while you would normally fix this by 
telling the javac compiler to consider the java.rmi module (sorry not 
sure exact flags to use) in this case I don't think you have that 
option. It may be easier to define your custom classes in a different 
package, ie in javax.lang.memory, outside of the base module.

> java/lang/memory/GroupListener.java:13: warning: [exports] class Group in module java.base is not accessible to clients that require this module
>          public final ArrayList<Group> groups = new ArrayList<Group>();

When you add new packages to a module that you need other code to be 
able to access from outside the module, you have to update the 
module-info.java file, for that module, to export those packages.

David
-----

> 
> 
> == ==
> 
> 
> Can we get explanations for each of these?  Also the solutions or workarounds.  OkQ!
> 
> 
> Thanks,
> 
> 
> Max R.
> 
> 
> Software Lead
> 


More information about the core-libs-dev mailing list