Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Access restriction: The type Logger is not accessible due to restriction...(Problem with Xtend, Logger and eclipse RCP plugin project.)
Access restriction: The type Logger is not accessible due to restriction... [message #1774576] Tue, 17 October 2017 13:23 Go to next message
David  Riobó is currently offline David RiobóFriend
Messages: 9
Registered: August 2017
Junior Member
Hi,

I've been working with Eclipse RCP for some time now and I've encountered a problem on Eclipse that does not show up when maven-building my product.

Access restriction: The type Logger is not accessible due to restriction on required project org.avl.mdml.commands MDML04Generator.xtend /org.avl.mdml.core/src/org/avl/mdml/mydsl/generator line: 13 /org.avl.mdml.core/src/org/avl/mdml/mydsl/generator/MDML04Generator.xtend Xtend Problem

There are 10 of these errors in my workspace referencing 3 different projects. However, this is just an Eclipse project problem. I am not sure I am missing something when using the org.apache.log4j.Logger, I've added the dependency in the manifest but this error repeats itself for 3 projects and I don't know what kind of restriction could it be talking about.

If someone encountered this problem it would be helpful. I know you can tell Xtend to omit this errors on Eclipse but I want to know the cause and fix it if possible.

Thanks!
Re: Access restriction: The type Logger is not accessible due to restriction... [message #1774593 is a reply to message #1774576] Tue, 17 October 2017 15:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12229
Registered: July 2009
Senior Member
Hi would be interesting to have a minimal reproducing example

Maybe you use eg xtends log active annotation


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Access restriction: The type Logger is not accessible due to restriction... [message #1774792 is a reply to message #1774593] Thu, 19 October 2017 15:51 Go to previous messageGo to next message
David  Riobó is currently offline David RiobóFriend
Messages: 9
Registered: August 2017
Junior Member
Hi again, sorry for the late answer.

My code is based on the old tutorial for code generation. Here is a piece that gets me the error, for example:

import org.apache.log4j.Logger

/**
* Generates code from your model files on save.
*
* see http://www.eclipse.org/Xtext/documentation.html#TutorialCodeGeneration
*/
class MyLanguageGenerator implements IGenerator {

private BiMap<String,EObject> lookup
static Logger log = Logger.getLogger(typeof(MyLanguageGenerator).name)

override void doGenerate(Resource resource, IFileSystemAccess fsa) {
try{
var language = resource.contents.head as Model
}
catch(Exception e){
log.error("Exception", e)
}
}

}

Is it a problem of the code? How should I add the dependency if that is the problem?

Not sure this is reproducible enough :/ The error, as said before, is of the class "Access restriction: The type Logger is not accessible due to restriction on required project MyLanguageProject", the project where this class is placed.
Re: Access restriction: The type Logger is not accessible due to restriction... [message #1774794 is a reply to message #1774792] Thu, 19 October 2017 16:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12229
Registered: July 2009
Senior Member
i cannot reproduce this.
where did you put the generator class to?
https://www.eclipse.org/Xtext/documentation/103_domainmodelnextsteps.html is the new docs.
is log4j inside the manifest under required bundles?



Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Access restriction: The type Logger is not accessible due to restriction... [message #1777953 is a reply to message #1774794] Wed, 06 December 2017 17:28 Go to previous messageGo to next message
David  Riobó is currently offline David RiobóFriend
Messages: 9
Registered: August 2017
Junior Member
I totally missed this issue since we had some other problems coming up. I ended up deactivating the "Forbidden reference" from the Xtend configuration.

Yes, I've just tried and they are in all the projects where the restrictions come from. Everything works as expected, the Eclipse product runs the code without any problems, but Eclipse complains about this "restriction"
Re: Access restriction: The type Logger is not accessible due to restriction... [message #1777954 is a reply to message #1777953] Wed, 06 December 2017 17:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12229
Registered: July 2009
Senior Member
can you share a reproduce sample project?

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Access restriction: The type Logger is not accessible due to restriction... [message #1777996 is a reply to message #1777954] Thu, 07 December 2017 14:04 Go to previous message
David  Riobó is currently offline David RiobóFriend
Messages: 9
Registered: August 2017
Junior Member
I was trying to share a project with the less amount of proprietary code as possible and turns out the error was gone.

By testing it out Irealized there was a redundant declaration of log4j as "Imported Package" and "Required Plug-in", I was blind enough to not see it before. I repeated the problem in all my other projects and this error is gone.

I'm sorry I took part of your time for this! At least when trying to reproduce it I was able to fix it myself :D

Thank you!
Previous Topic:Whitepaper on Integrating Xtext with Sirius
Next Topic:Xtend generated code uses Java8 API's even though the project is still JavaSE-1.7
Goto Forum:
  


Current Time: Wed Sep 19 09:11:55 GMT 2018

Powered by FUDForum. Page generated in 0.01857 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top