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 6646203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:23:15+00:00 2026-05-26T00:23:15+00:00

is it possible to write an AspectJ pointcut that matches the usage of a

  • 0

is it possible to write an AspectJ pointcut that matches the usage of a specific operator with a specific type?

Some background information: I’m working on a project where we have to use a legacy Java library (pre 5.0, before the enum keyword) which comes with several “pseudo-enum” types, i.e. normal Java classes that define static constants of its own type. Those “feel” very much like enums, but using them like enums can result in an error. Therefore I’d like AspectJ to mark uses of == with objects of one of these types as an error, if that is possible. I have googled this and consulted the normally very helpful book AspectJ in action, but so far without success. Any help is appreciated.

  • 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-26T00:23:16+00:00Added an answer on May 26, 2026 at 12:23 am

    == is not the same as equals(), and is implemented by the JVM, and as far as I can tell cannot be modified by aspectj. Also, I don’t think that AspectJ is the correct tool for this job.

    A better approach would be to implement a Checkstyle rule or similar for your project to allow you indicate these points. You could have them as errors or warnings. See Writing Checks for Checkstyle for more information.

    This would require some coding, but so would the aspectJ solution.

    Checkstyle has an eclipse plugin as well as a maven plugin, so you could have these errors appearing as you work in the IDE.

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

Sidebar

Related Questions

Is it possible to write GLSL ES fragment shaders under iOS that generate multiple
Is it possible to write generic class with one constructor which explicitly defines type
Is it possible to write a program that will change the phone numbers a
I was wondering if i could possible write an app, that could be a
Possible Duplicate: Write a function that returns the longest palindrome in a given string
Is it possible to write a query that will return only the value of
If it possible to write byte code for a method that is supposed to
Possible Duplicate: Write a recursive function that reverses the input Recently, I've been reading
Possible Duplicate: Write a function that returns the longest palindrome in a given string
Is it possible to write a method that takes a stringstream and have it

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.