[jbosstools-issues] [JBoss JIRA] (JBIDE-14528) Add 'quick fix' to 'warning type not in deployment'

Snjezana Peco (JIRA) jira-events at lists.jboss.org
Fri Oct 18 11:36:01 EDT 2013


    [ https://issues.jboss.org/browse/JBIDE-14528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12823233#comment-12823233 ] 

Snjezana Peco commented on JBIDE-14528:
---------------------------------------

This feature works in the following way:

1) If a deployment method returns a variable, the quickfix adds the addClass statement.

Before
{code}
@Deployment
public static Archive<?> createDeployment() {
	WebArchive archive = ShrinkWrap.create(WebArchive.class)
			.addClass(Manager.class)
			.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
	return archive;
}
{code}

After 
{code}
@Deployment
public static Archive<?> createDeployment() {
	WebArchive archive = ShrinkWrap.create(WebArchive.class)
			.addClass(Manager.class)
			.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
	archive.addClass(SuperManager.class);
	return archive;
}
{code}

2) if a deployment method returns a statement expression, the quickfix extracts a local variable and adds the addClass statement.

Before
{code}
@Deployment
public static Archive<?> createDeployment() {
	return ShrinkWrap.create(WebArchive.class)
			.addClass(Manager.class)
			.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
{code}

After 
{code}
@Deployment
public static Archive<?> createDeployment() {
	WebArchive archive = ShrinkWrap.create(WebArchive.class)
			.addClass(Manager.class)
			.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
	archive.addClass(SuperManager.class);
	return archive;
}
{code}

See http://screencast.com/t/1SEj0AozF15k.
Attached is a project I have used.

The following are possible improvements:

We could try to find the invocation of the Archive.addClasses() and Archive.addClass method and add a new class to those methods.
Please reopen the jira or create a new one if you want me to do it.
                
> Add 'quick fix' to 'warning type not in deployment'
> ---------------------------------------------------
>
>                 Key: JBIDE-14528
>                 URL: https://issues.jboss.org/browse/JBIDE-14528
>             Project: Tools (JBoss Tools)
>          Issue Type: Sub-task
>          Components: testing-tools
>            Reporter: Aslak Knutsen
>            Assignee: Snjezana Peco
>             Fix For: 4.2.0.Alpha1
>
>
> Given a test case with a deployment method
> When there is a missing Type reference from the TestClass that is not found in the deployment
> Then the Warning should provide a 'quick fix' option to add the missing type

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list