Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in type conversion for using @Separator for Abstract attribute #89

Closed
hemus2121 opened this issue Aug 19, 2014 · 1 comment
Closed

Comments

@hemus2121
Copy link

Hi,
In Type conversion example we have following for Separator Annotation [http://owner.aeonbits.org/docs/type-conversion/]

@Separator(File.pathSeparator);
File[] path();

-- I fails compilation saying "Attribute value must be Constant", on probing further found that we have pathSeparator in defined as
" public static final String pathSeparator = "" + pathSeparatorChar;" in File.java
and pathSeparatorChar resolves to fs.getPathSeparator() and method getPathSeparator()resolves to abstract char attribute of FileSystem.java

--During compile time we will not be able make out what is actual value for getPathSeparator() since its abstract and no concrete values can be deduced and during run-time this depends on underlying OS File System.

-- So Separator can't make out run-time dependent values and values has to be resolved at compile time only.

@lviggiano
Copy link
Collaborator

Good catch. We should probably remove that line from the example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants