|
|
|
Re: How to remove an Internal Discouraged Access Warnings for NewKeysPreferencePage? [message #335160 is a reply to message #335122] |
Tue, 24 March 2009 13:58 |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
On 3/23/2009 12:47 PM, Walter Harley wrote:
> "Anders Baumann"<anb@maconomy.dk> wrote in message
> news:gq87rv$rgb$1@build.eclipse.org...
>> Hi all.
>> In my application I have added the
>> "org.eclipse.ui.internal.keys.NewKeysPreferencePage" as one of the pages
>> of the Preference dialog. In my "Problem view" I get a following warning:
>>
>> "Access to referenced class
>> 'org.eclipse.ui.internal.keys.NewKeysPreferencePage' in attribute 'class'
>> is discouraged plugin.xml ..."
>>
>> I would like to remove this warning, so I have tried to do as described
>> here:
>> http://wiki.eclipse.org/DTP_Resolving_Internal_Discouraged_A ccess_Warnings.
>> Unfortunately, it doesn't work. The warning is still there. I add the
>> following lines to the .classpath file:
>>
>> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
>> <accessrules>
>> <accessrule kind="accessible"
>> pattern="org/eclipse/ui/internal/NewKeysPreferencePage"/>
>> </accessrules>
>> </classpathentry>
>>
>> What am I doing wrong?
>
>
> You're using an internal interface. Eclipse is warning you that you're
> using code that is likely to change in a future version, thus breaking your
> plug-in. In other words, by doing this you're committing to updating your
> plug-in with every version of Eclipse (not to mention distributing multiple
> versions of your plug-in). You should make sure to set version ranges in
> your plug-in dependencies.
>
> The reason your effort to suppress the warning didn't work appears to be
> that you are missing a "/keys" in the access pattern.
I agree with Walter; you should leave the warning in place as a reminder
that you are doing something that is discouraged.
If you really want to remove the warning, it is easier to just use the
QuickFix (put cursor on the marked line of code and hit Ctrl+1) to
insert an @SuppressWarnings("restriction") annotation.
Hope this helps,
Eric
|
|
|
Re: How to remove an Internal Discouraged Access Warnings for NewKeysPreferencePage? [message #335162 is a reply to message #335160] |
Tue, 24 March 2009 14:49 |
Anders Baumann Messages: 55 Registered: July 2009 |
Member |
|
|
Hi Eric.
Thanks for your answer.
But how do I put a @SuppressWarnings("restriction") in an XML file? The
warning is in the plugin.xml.
Also, Is there a better or other way to use the NewKeysPreferencePage in my
preference dialog? It must be a very common thing to have a "Keys"
preference page in a RCP application.
Thanks in advance,
Anders Baumann
"Eric Rizzo" <eclipse-news@rizzoweb.com> wrote in message
news:gqaou6$peb$1@build.eclipse.org...
> On 3/23/2009 12:47 PM, Walter Harley wrote:
>> "Anders Baumann"<anb@maconomy.dk> wrote in message
>> news:gq87rv$rgb$1@build.eclipse.org...
>>> Hi all.
>>> In my application I have added the
>>> "org.eclipse.ui.internal.keys.NewKeysPreferencePage" as one of the pages
>>> of the Preference dialog. In my "Problem view" I get a following
>>> warning:
>>>
>>> "Access to referenced class
>>> 'org.eclipse.ui.internal.keys.NewKeysPreferencePage' in attribute
>>> 'class'
>>> is discouraged plugin.xml ..."
>>>
>>> I would like to remove this warning, so I have tried to do as described
>>> here:
>>> http://wiki.eclipse.org/DTP_Resolving_Internal_Discouraged_A ccess_Warnings.
>>> Unfortunately, it doesn't work. The warning is still there. I add the
>>> following lines to the .classpath file:
>>>
>>> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
>>> <accessrules>
>>> <accessrule kind="accessible"
>>> pattern="org/eclipse/ui/internal/NewKeysPreferencePage"/>
>>> </accessrules>
>>> </classpathentry>
>>>
>>> What am I doing wrong?
>>
>>
>> You're using an internal interface. Eclipse is warning you that you're
>> using code that is likely to change in a future version, thus breaking
>> your
>> plug-in. In other words, by doing this you're committing to updating
>> your
>> plug-in with every version of Eclipse (not to mention distributing
>> multiple
>> versions of your plug-in). You should make sure to set version ranges in
>> your plug-in dependencies.
>>
>> The reason your effort to suppress the warning didn't work appears to be
>> that you are missing a "/keys" in the access pattern.
>
> I agree with Walter; you should leave the warning in place as a reminder
> that you are doing something that is discouraged.
> If you really want to remove the warning, it is easier to just use the
> QuickFix (put cursor on the marked line of code and hit Ctrl+1) to insert
> an @SuppressWarnings("restriction") annotation.
>
> Hope this helps,
> Eric
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03606 seconds