Bug 455293 - Class Annotation (MAYBE Duplicate with 405016)
Summary: Class Annotation (MAYBE Duplicate with 405016)
Status: RESOLVED DUPLICATE of bug 455608
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.8.0.M1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 1.8.5   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-16 01:04 EST by Alireza Fattahi CLA
Modified: 2015-01-07 20:10 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alireza Fattahi CLA 2014-12-16 01:04:29 EST
Below code uses spring classes to import a resources.
I The exception is shown @Conditional.


import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ConfigurationCondition;
import org.springframework.context.annotation.ImportResource;
import org.springframework.core.type.AnnotatedTypeMetadata;

@Configuration
@Conditional(ConditionalConfiguration.Condition)
@ImportResource("/com/example/context-fragment.xml")
public class ConditionalConfiguration {
    static class Condition implements ConfigurationCondition {
         @Override 
         
         public ConfigurationPhase getConfigurationPhase() {
             return ConfigurationPhase.PARSE_CONFIGURATION;
         }          
         @Override
         public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
             // only load context-fragment.xml if the system property is defined
             return System.getProperty("com.example.context-fragment") != null;
         }
    }
}



The error is shown as:

org.aspectj.weaver.BCException
at org.aspectj.ajdt.internal.core.builder.AjState.recordClassFile(AjState.java:1519)
at org.aspectj.ajdt.internal.core.builder.AjState.noteResult(AjState.java:1325)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager$3.acceptResult(AjBuildManager.java:1061)
at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.afterProcessing(AjPipeliningCompilerAdapter.java:426)
at org.aspectj.ajdt.intern ... .0_21-64\jre\lib\ext\sunmscapi.jar;E:\jdk1.7.0_21-64\jre\lib\ext\zipfs.jar;D:\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar;

The Condition anotation is as below:

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface Conditional {

	/**
	 * All {@link Condition}s that must {@linkplain Condition#matches match}
	 * in order for the component to be registered.
	 */
	Class<? extends Condition>[] value();

}
Comment 1 Andrew Clement CLA 2015-01-07 20:10:35 EST
Actually I think this is the same as bug 455608 (I think you were the person asking about this on SO weren't you?). Both of which are a JDT problem.
The JDT bug I've raised is referenced in bug 455608. Once fixed I'll pick up that fix in AJ.

*** This bug has been marked as a duplicate of bug 455608 ***
Comment 2 Andrew Clement CLA 2015-01-07 20:10:53 EST
setting resolved version.