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

  • Home
  • SEARCH
  • 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 6058825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:38:33+00:00 2026-05-23T08:38:33+00:00

i have a child Class, that needs an Annotation, that is declared in the

  • 0

i have a child Class, that needs an Annotation, that is declared in the Parent class removed. What is the best way to do this?

public class Parent

@MyAnnoation
String foobar;

}


public class Child extends Parent {
//here I only want to remove the @MyAnnotation from String foobar;

}

What I want to avoid is, “overriding” the member

 public class Child extends Parent {

 String foobar;

 }

as this has several disadvantages (as it “covers” the underlaying parent member = this.foobar can be different to super.foobar)…

1.) Is there an easy way of removing an annotation from a Parent Class in the Subclass (here Child)?

2.) What is the official way to remove annotations in a Subclass?

Thanks very much! Markus

  • 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-23T08:38:33+00:00Added an answer on May 23, 2026 at 8:38 am

    If you want to do something like this than you probably should have another look at your design.

    I think that if there is a way to remove a runtime annotation than that would not be recommended, because you would be remove a part of a class definition. Like removing a member access modifier for instance.

    That can have unexpected results on your logic since other code might rely on these definitions to make runtime decisions.

    If you need to modify a class definition during runtime than this class should probably not be defined in such a way in the first place.

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

Sidebar

Related Questions

guys, I have a case that needs the child class needs to call its
I have a static function in a class that needs to be called from
I have a java class that creates a process, called child, using ProcessBuilder. The
I have the following class structure that I need to unit test: public interface
Given a structure like this: class Parent { } class Child : Parent {
I have a WCF client that needs to generate a request containing this XML
I have a JAX-RPC (Java) web service that needs to return a complex polymorphic
I have a class in my domain model called JobPlan this class is stored
I have a question related to OOPS concept. I have a base class public
I have a DataMapper many to many relationship, friends, that needs to be kept

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.