2

So I have this Annotator interface:

public interface Annotator {
    String getViewName();

    View getView(TextAnnotation var1) throws AnnotatorException;

    String[] getRequiredViews();
}

which is extended by GazetteerViewGenerator:

public class GazetteerViewGenerator extends Annotator {
    public static final GazetteerViewGenerator gazetteersInstance;
    ... 

The issue is that when I create an object of GazetteerViewGenerator and cast into Annotator it gives me errors, which is really weird:

public class MyCuratorClient {
    public static Annotator gazetteers = (Annotator) GazetteerViewGenerator.gazetteersInstance;
    ... 

and here is the error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project Illinois-Combined-Coref: Compilation failure
[ERROR] /Users/danielk/ideaProjects/Illinois-Combined-Coref/src/main/java/edu/illinois/cs/cogcomp/lbj/coref/util/MyCuratorClient.java:[25,38] error: cannot access Annotator
[ERROR] -> [Help 1]
[ERROR] 

Any ideas where I am going wrong?

2 Answers 2

4

A java class implements an interface rather than extends it.

You should have used this class definition:

public class GazetteerViewGenerator implements Annotator {
    public static final GazetteerViewGenerator gazetteersInstance;
    ... 
}
Sign up to request clarification or add additional context in comments.

Comments

0

As to the "Cannot access..." error, I found that intelliJ has a blocking bug preventing you refreshing from changed packaging. It's possible that your code has no issue at all but is underlined with wiggly red lines in IDE. Try to re-open the project again and your problem may be solved with no change.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.