Discussion:
[tycho-user] 1.0 fails build with access restriction
Hussein, Mohamed
2017-04-21 13:55:05 UTC
Permalink
Hi,

I had a build of a plugin that uses DOM classes from rt.jar that was building fine with 0.26.0 but when I changed Tycho.version to 1.0.0 it started failing with the following error:

[ERROR] serializer.getDomConfig().setParameter(Constants.DOM_FORMAT_PRETTY_PRINT, true);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Access restriction: The field 'Constants.DOM_FORMAT_PRETTY_PRINT' is not API (restriction on classpath entry 'C:\bin\jdk1.8.0_112\jre\lib\rt.jar')

I have the following in the configuration of the Tycho-compiler-plugin

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgument>-warn:none</compilerArgument>
<compilerArgument>-err:none</compilerArgument>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

I also tried
<compilerArgument>-err:-forbidden</compilerArgument>
<compilerArgument>-warn:-forbidden</compilerArgument>

I read through https://bugs.eclipse.org/bugs/show_bug.cgi?id=369187 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=367431 but couldn't understand what more to do.

State:

- Building with 0.26.0 with no compiler arguments FAIL

- Building with 0.26.0 with -warn:none and -err:none compiler arguments *PASS*

- Building with 1.0.0 with -warn:none and -err:none compiler arguments FAIL

- Building with 1.0.0 with no compiler arguments FAIL

Any clues?

Best Regards,
Mohamed.
Sievers, Jan
2017-04-21 14:24:22 UTC
Permalink
I assume you are accessing JDK internal packages.

If you want to relax access restriction errors, you should be able to use
https://eclipse.org/tycho/sitedocs/tycho-compiler-plugin/compile-mojo.html#compilerArgs


<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgs>
<arg>-err:-forbidden</arg>
</compilerArgs>
</configuration>
</plugin>

note the nested compilerArgs XML structure. If you put two compilerArgument flattened into the configuration, I'm not sure which one wins or if it's even specified.

See JDT batch compiler args
https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-using_batch_compiler.htm


Jan


On 21.04.17, 15:55, "tycho-user-***@eclipse.org on behalf of Hussein, Mohamed" <tycho-user-***@eclipse.org on behalf of ***@mentor.com> wrote:

Hi,

I had a build of a plugin that uses DOM classes from rt.jar that was building fine with 0.26.0 but when I changed Tycho.version to 1.0.0 it started failing with the following error:

[ERROR] serializer.getDomConfig().setParameter(Constants.DOM_FORMAT_PRETTY_PRINT, true);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Access restriction: The field 'Constants.DOM_FORMAT_PRETTY_PRINT' is not API (restriction on classpath entry 'C:\bin\jdk1.8.0_112\jre\lib\rt.jar')

I have the following in the configuration of the Tycho-compiler-plugin

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgument>-warn:none</compilerArgument>

<compilerArgument>-err:none</compilerArgument>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

I also tried
<compilerArgument>-err:-forbidden</compilerArgument>
<compilerArgument>-warn:-forbidden</compilerArgument>


I read through
https://bugs.eclipse.org/bugs/show_bug.cgi?id=369187 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=369187> and
https://bugs.eclipse.org/bugs/show_bug.cgi?id=367431 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=367431> but couldn’t understand what more to do.

State:
-
Building with 0.26.0 with no compiler arguments FAIL
-
Building with 0.26.0 with –warn:none and –err:none compiler arguments *PASS*
-
Building with 1.0.0 with –warn:none and –err:none compiler arguments FAIL
-
Building with 1.0.0 with no compiler arguments FAIL

Any clues?

Best Regards,
Mohamed.
Hussein, Mohamed
2017-04-21 14:36:13 UTC
Permalink
Thanks Jan for the info,

You are right about compilerArgs, I switched to use that now, but unfortunately it didn't change the behavior, the following still works in 0.26.0 and fails in 1.0.0

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgs>
<arg>-err:-forbidden</arg>
<arg>-warn:-forbidden</arg>
</compilerArgs>

<!-- Allow Java 8 language -->
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

Best Regards,
Mohamed.
-----Original Message-----
Sent: Friday, April 21, 2017 9:24 AM
Subject: Re: [tycho-user] 1.0 fails build with access restriction
I assume you are accessing JDK internal packages.
If you want to relax access restriction errors, you should be able to use
https://eclipse.org/tycho/sitedocs/tycho-compiler-plugin/compile-
mojo.html#compilerArgs
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgs>
<arg>-err:-forbidden</arg>
</compilerArgs>
</configuration>
</plugin>
note the nested compilerArgs XML structure. If you put two
compilerArgument flattened into the configuration, I'm not sure which one
wins or if it's even specified.
See JDT batch compiler args
https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%
2Ftasks%2Ftask-using_batch_compiler.htm
Jan
Hi,
I had a build of a plugin that uses DOM classes from rt.jar that was building
fine with 0.26.0 but when I changed Tycho.version to 1.0.0 it started failing
[ERROR]
serializer.getDomConfig().setParameter(Constants.DOM_FORMAT_PRETTY_
PRINT, true);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Access restriction: The field
'Constants.DOM_FORMAT_PRETTY_PRINT' is not API (restriction on classpath
entry 'C:\bin\jdk1.8.0_112\jre\lib\rt.jar')
I have the following in the configuration of the Tycho-compiler-plugin
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgument>-warn:none</compilerArgument>
<compilerArgument>-err:none</compilerArgument>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
I also tried
<compilerArgument>-err:-forbidden</compilerArgument>
<compilerArgument>-warn:-forbidden</compilerArgument>
I read through
https://bugs.eclipse.org/bugs/show_bug.cgi?id=369187
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=369187> and
https://bugs.eclipse.org/bugs/show_bug.cgi?id=367431
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=367431> but couldn’t
understand what more to do.
-
Building with 0.26.0 with no compiler arguments FAIL
-
Building with 0.26.0 with –warn:none and –err:none compiler arguments *PASS*
-
Building with 1.0.0 with –warn:none and –err:none compiler arguments FAIL
-
Building with 1.0.0 with no compiler arguments FAIL
Any clues?
Best Regards,
Mohamed.
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
Sievers, Jan
2017-04-21 14:52:18 UTC
Permalink
if you have a small sample project that shows the problem, open a bug with steps to reproduce.

off the top of my head I don't think there are changes in Tycho that could cause a different behaviour.
However the underlying JDT compiler version was updated going from 0.26.0 to 1.0.0

Regards
Jan

On 21.04.17, 16:36, "tycho-user-***@eclipse.org on behalf of Hussein, Mohamed" <tycho-user-***@eclipse.org on behalf of ***@mentor.com> wrote:

Thanks Jan for the info,

You are right about compilerArgs, I switched to use that now, but unfortunately it didn't change the behavior, the following still works in 0.26.0 and fails in 1.0.0

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgs>
<arg>-err:-forbidden</arg>
<arg>-warn:-forbidden</arg>
</compilerArgs>

<!-- Allow Java 8 language -->
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

Best Regards,
Mohamed.
-----Original Message-----
Sent: Friday, April 21, 2017 9:24 AM
Subject: Re: [tycho-user] 1.0 fails build with access restriction
I assume you are accessing JDK internal packages.
If you want to relax access restriction errors, you should be able to use
https://eclipse.org/tycho/sitedocs/tycho-compiler-plugin/compile-
mojo.html#compilerArgs
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgs>
<arg>-err:-forbidden</arg>
</compilerArgs>
</configuration>
</plugin>
note the nested compilerArgs XML structure. If you put two
compilerArgument flattened into the configuration, I'm not sure which one
wins or if it's even specified.
See JDT batch compiler args
https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%
2Ftasks%2Ftask-using_batch_compiler.htm
Jan
Hi,
I had a build of a plugin that uses DOM classes from rt.jar that was building
fine with 0.26.0 but when I changed Tycho.version to 1.0.0 it started failing
[ERROR]
serializer.getDomConfig().setParameter(Constants.DOM_FORMAT_PRETTY_
PRINT, true);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Access restriction: The field
'Constants.DOM_FORMAT_PRETTY_PRINT' is not API (restriction on classpath
entry 'C:\bin\jdk1.8.0_112\jre\lib\rt.jar')
I have the following in the configuration of the Tycho-compiler-plugin
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgument>-warn:none</compilerArgument>
<compilerArgument>-err:none</compilerArgument>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
I also tried
<compilerArgument>-err:-forbidden</compilerArgument>
<compilerArgument>-warn:-forbidden</compilerArgument>
I read through
https://bugs.eclipse.org/bugs/show_bug.cgi?id=369187
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=369187> and
https://bugs.eclipse.org/bugs/show_bug.cgi?id=367431
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=367431> but couldn’t
understand what more to do.
-
Building with 0.26.0 with no compiler arguments FAIL
-
Building with 0.26.0 with –warn:none and –err:none compiler arguments *PASS*
-
Building with 1.0.0 with –warn:none and –err:none compiler arguments FAIL
-
Building with 1.0.0 with no compiler arguments FAIL
Any clues?
Best Regards,
Mohamed.
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
tycho-***@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
Sievers, Jan
2017-04-21 14:58:19 UTC
Permalink
did you check the useProjectSettings behaviour change announced in the release notes
https://wiki.eclipse.org/Tycho/Release_Notes/1.0.0


Jan


On 21.04.17, 16:52, "tycho-user-***@eclipse.org on behalf of Sievers, Jan" <tycho-user-***@eclipse.org on behalf of ***@sap.com> wrote:

if you have a small sample project that shows the problem, open a bug with steps to reproduce.

off the top of my head I don't think there are changes in Tycho that could cause a different behaviour.
However the underlying JDT compiler version was updated going from 0.26.0 to 1.0.0

Regards
Jan

On 21.04.17, 16:36, "tycho-user-***@eclipse.org on behalf of Hussein, Mohamed" <tycho-user-***@eclipse.org on behalf of ***@mentor.com> wrote:

Thanks Jan for the info,

You are right about compilerArgs, I switched to use that now, but unfortunately it didn't change the behavior, the following still works in 0.26.0 and fails in 1.0.0

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgs>
<arg>-err:-forbidden</arg>
<arg>-warn:-forbidden</arg>
</compilerArgs>

<!-- Allow Java 8 language -->
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

Best Regards,
Mohamed.
-----Original Message-----
Sent: Friday, April 21, 2017 9:24 AM
Subject: Re: [tycho-user] 1.0 fails build with access restriction
I assume you are accessing JDK internal packages.
If you want to relax access restriction errors, you should be able to use
https://eclipse.org/tycho/sitedocs/tycho-compiler-plugin/compile-
mojo.html#compilerArgs
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgs>
<arg>-err:-forbidden</arg>
</compilerArgs>
</configuration>
</plugin>
note the nested compilerArgs XML structure. If you put two
compilerArgument flattened into the configuration, I'm not sure which one
wins or if it's even specified.
See JDT batch compiler args
https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%
2Ftasks%2Ftask-using_batch_compiler.htm
Jan
Hi,
I had a build of a plugin that uses DOM classes from rt.jar that was building
fine with 0.26.0 but when I changed Tycho.version to 1.0.0 it started failing
[ERROR]
serializer.getDomConfig().setParameter(Constants.DOM_FORMAT_PRETTY_
PRINT, true);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Access restriction: The field
'Constants.DOM_FORMAT_PRETTY_PRINT' is not API (restriction on classpath
entry 'C:\bin\jdk1.8.0_112\jre\lib\rt.jar')
I have the following in the configuration of the Tycho-compiler-plugin
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgument>-warn:none</compilerArgument>
<compilerArgument>-err:none</compilerArgument>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
I also tried
<compilerArgument>-err:-forbidden</compilerArgument>
<compilerArgument>-warn:-forbidden</compilerArgument>
I read through
https://bugs.eclipse.org/bugs/show_bug.cgi?id=369187
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=369187> and
https://bugs.eclipse.org/bugs/show_bug.cgi?id=367431
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=367431> but couldn’t
understand what more to do.
-
Building with 0.26.0 with no compiler arguments FAIL
-
Building with 0.26.0 with –warn:none and –err:none compiler arguments *PASS*
-
Building with 1.0.0 with –warn:none and –err:none compiler arguments FAIL
-
Building with 1.0.0 with no compiler arguments FAIL
Any clues?
Best Regards,
Mohamed.
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
tycho-***@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user

_______________________________________________
tycho-user mailing list
tycho-***@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
Hussein, Mohamed
2017-04-21 15:04:43 UTC
Permalink
Excellent catch Jan, THANKS!

That project had an old .settings folder with jdt compiler settings that seems to ask for Java 1.5 for some reason (attached for reference)

Removing that fixed the issue.

Thanks again.

Best Regards,
Mohamed.
-----Original Message-----
Sent: Friday, April 21, 2017 9:58 AM
Subject: Re: [tycho-user] 1.0 fails build with access restriction
did you check the useProjectSettings behaviour change announced in the release notes
https://wiki.eclipse.org/Tycho/Release_Notes/1.0.0
Jan
if you have a small sample project that shows the problem, open a bug with
steps to reproduce.
off the top of my head I don't think there are changes in Tycho that could
cause a different behaviour.
However the underlying JDT compiler version was updated going from 0.26.0 to 1.0.0
Regards
Jan
Thanks Jan for the info,
You are right about compilerArgs, I switched to use that now, but
unfortunately it didn't change the behavior, the following still works in 0.26.0
and fails in 1.0.0
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgs>
<arg>-err:-forbidden</arg>
<arg>-warn:-forbidden</arg>
</compilerArgs>
<!-- Allow Java 8 language -->
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
Best Regards,
Mohamed.
-----Original Message-----
Sent: Friday, April 21, 2017 9:24 AM
Subject: Re: [tycho-user] 1.0 fails build with access restriction
I assume you are accessing JDK internal packages.
If you want to relax access restriction errors, you should be able to use
https://eclipse.org/tycho/sitedocs/tycho-compiler-plugin/compile-
mojo.html#compilerArgs
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgs>
<arg>-err:-forbidden</arg>
</compilerArgs>
</configuration>
</plugin>
note the nested compilerArgs XML structure. If you put two
compilerArgument flattened into the configuration, I'm not sure which
one wins or if it's even specified.
See JDT batch compiler args
https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.u
ser% 2Ftasks%2Ftask-using_batch_compiler.htm
Jan
Hi,
I had a build of a plugin that uses DOM classes from rt.jar that was
building fine with 0.26.0 but when I changed Tycho.version to 1.0.0 it
[ERROR]
serializer.getDomConfig().setParameter(Constants.DOM_FORMAT_PRETTY_
PRINT, true);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Access restriction: The field
'Constants.DOM_FORMAT_PRETTY_PRINT' is not API (restriction on
classpath entry 'C:\bin\jdk1.8.0_112\jre\lib\rt.jar')
I have the following in the configuration of the Tycho-compiler-plugin
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgument>-warn:none</compilerArgument>
<compilerArgument>-err:none</compilerArgument>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
I also tried
<compilerArgument>-err:-forbidden</compilerArgument>
<compilerArgument>-warn:-forbidden</compilerArgument>
I read through
https://bugs.eclipse.org/bugs/show_bug.cgi?id=369187
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=369187> and
https://bugs.eclipse.org/bugs/show_bug.cgi?id=367431
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=367431> but couldn’t
understand what more to do.
-
Building with 0.26.0 with no compiler arguments FAIL
-
Building with 0.26.0 with –warn:none and –err:none compiler arguments
*PASS*
-
Building with 1.0.0 with –warn:none and –err:none compiler arguments
FAIL
-
Building with 1.0.0 with no compiler arguments FAIL
Any clues?
Best Regards,
Mohamed.
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit https://dev.eclipse.org/mailman/listinfo/tycho-user
Loading...