Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 328371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:29:20+00:00 2026-05-12T09:29:20+00:00

I have set up an annotation that will be used to keep track of

  • 0

I have set up an annotation that will be used to keep track of classes, however I am getting an error when I try to compile any java code that uses the annotation.

Here is the annotation code:

package tlib.anno;

import java.lang.annotation.*;

@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.TYPE )

public @interface Class
{
    String author();
    String contact();
    String creationDate();
    String creationTime();

    String lastUpdateDate();
    String lastUpdateTime();

    int version() default 1;
    int majorVersion() default 0;
    int minorVersion() default 0;
    int build() default 1;
}

Then when I try to use the annotation like so:

import tlib.anno.Class;

...

@Class( author = "tjlevine",
    creationDate = "2/18/09",
    creationTime = "11:20:16 PM",
    lastUpdateDate = "2/18/09",
    lastUpdateTime = "11:27 PM",
    version = 1,
    majorVersion = 1,
    minorVersion = 0 )
public class Vector2d implements Cloneable
{
    ...
}

The compiler gives me this error:

/media/disk/programming/java/tLib/src/tlib/math/Vector2d.java:13: annotation tlib.anno.Class is missing contact

Google is of little help with this error, and I can’t figure out what it is telling me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:29:21+00:00Added an answer on May 12, 2026 at 9:29 am

    Change it to:

    public @interface Class {
      String author() default "";
      String contact() default "";
      String creationDate() default "";
      String creationTime() default "";
    
      String lastUpdateDate() default "";
      String lastUpdateTime() default "";
    
      int version() default 1;
      int majorVersion() default 0;
      int minorVersion() default 0;
      int build() default 1;
    }
    

    Basically the compiler is complaining because the way you’ve defined it, contact is required and you haven’t specified it.

    Of course you may not want to make all of these attributes optional. Just don’t specify a default value for any that are required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set up a Django application that uses images. I think I have
I have a Java Annotation Processor that extends from AbstractProcessor . I have two
I have been trying to set up Spring 3 annotation-based validation, guided by http://static.springsource.org/spring/docs/3.0.0.RC3/spring-framework-reference/html/ch05s07.html
I am using asp.net mvc 3 and I keep getting the following error. Validation
I have a maven project in eclipse and have maven goals that run annotation
I have a set of JPA POJO's that contain annotations required for mapping to
We have set up a system where notifications get sent to a user with
I have set a canvas' background to an image of a company logo. I
I have set up transactional replication between two SQL Servers on different ends of
I have set up a version control system using TortoiseSVN at my home to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.