JDK-7037412 : "incompatible types" Error on Annotations when not using compile time processor
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6u24
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_ubuntu
  • CPU: x86
  • Submitted: 2011-04-18
  • Updated: 2012-09-06
  • Resolved: 2011-04-19
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Ubuntu 10.04
OSX 10.6

EXTRA RELEVANT SYSTEM CONFIGURATION :
Using compile time Annotation processor

A DESCRIPTION OF THE PROBLEM :
As Per bug 6512707
http://bugs.sun.com/view_bug.do?bug_id=6512707

When any type of annotation processing or Retention is enabled at compile time Enumerators and Generic classes are not able to be found if defined as a default value of the annotation.

This is present in all 1.6SE but works in OpenJDK

REGRESSION.  Last worked in version 7

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
In Netbeans enable under Build->Compiling->Enable Annotations Processing

Create an Annotation which has a field whose default value that either implements Generics or an Enumerator.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Compile the Source Correctly
ACTUAL -
Failed to Compile Correctly

ERROR MESSAGES/STACK TRACES THAT OCCUR :
incompatible types
found   : com.cat.qis.util.struct.FormVisibilityEnum
required: com.cat.qis.util.struct.FormVisibilityEnum
  public FormVisibilityEnum visible() default FormVisibilityEnum.DISPLAYED;

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
/**
 *
 * @author Paul Scarrone(NuRelm)
 */
public @interface FormDisplay {

  /**
   *
   * @return
   */
  public FormVisibilityEnum visible() default FormVisibilityEnum.DISPLAYED;

}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author Paul Scarrone(NuRelm)
 */
public enum FormVisibilityEnum {
  /**
   *
   */
  DISPLAYED,
  /**
   *
   */
  NOTDISPLAYED,
  /**
   *
   */
  HIDDEN;
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
In Netbeans. Disable "Enable Annotations Processor" under project properties Build->Compile

Or use OpenJDK