Add entry point annotation via plugin

Answered

How can I add entry point annotation via a custom plugin?

I can see the following entry in the file <project_root>/.idea/misc.xml. We already have a custom plugin for code styles and other stuff so was wondering can we can add this.

<component name="EntryPointsManager">
    <list size="1">
      <item index="0" class="java.lang.String" itemvalue="com.foo.MyAnnotation" />
    </list>
  </component>

 

10 comments
Comment actions Permalink

com.intellij.deadCode extension point, com.intellij.codeInspection.reference.EntryPoint#getIgnoreAnnotations

see com.intellij.execution.junit2.inspection.JUnitEntryPoint as sample

0
Comment actions Permalink

Can't we just add that entry to any XML file? (For instance, our default profile project.default.xml)

0
Comment actions Permalink

Yes, you can modify the inspection settings Java | Declaration redundancy | Unused declaration by definining Annnotations there and use shared project-level inspection profile.

0
Comment actions Permalink

Our inspection/Default.xml file in the settings repo looks like this:

<inspections profile_name="Default" version="1.0">
  <option name="myName" value="Default" />
</inspections> 
  <inspection_tool class="OptionalIsPresent" enabled="false" level="WARNING" enabled_by_default="false" />
  <inspection_tool class="OptionalUsedAsFieldOrParameterType" enabled="false" level="WARNING" enabled_by_default="false" />
</inspections>

Can I add it there?

0
Comment actions Permalink

Simply edit the inspection settings in _Preferences | Editor | Inspections_

0
Comment actions Permalink

I've changed the config both in the Project Default (stored in project) and Default (stored in IDE), and the changes go to that file (<project_root>/.idea/misc.xml) in both cases.

How can I make this change as an IDE level change?

0
Comment actions Permalink

Sorry to bother you again.

Our repo is not allowed to push from the IDE, so the IDE's Upstream URL point to my local repo. However; when I make changes to the preferences I don't see the changes in my local repo. What am I doing wrong? I've tried with many preferences, including making a copy of the inspection profile.  

 

0
Comment actions Permalink

Poroto20
Could you please elaborate a bit more - by IDE's Upstream do you mean a URL specified for Settings repository?
Or do you use Git in your project? In this case you need to push changes to your upstream repository (even though it's local)

0
Comment actions Permalink

Yes, the URL specified for settings points to my local repo, which is a fork of the main repo. So instead of "git@git...." it points to "/Users/....."

But I don't see any changes in my repo, even when I go to File->IDE Settings->Sync->Overwrite remote.

I've tried with many properties but I don't see any difference. I even tried cloning and editing an inspection profile. 

 

 

 

0

Please sign in to leave a comment.