APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.tools.javac.util

public Class JavacMessages

extends Object
implements Messages
Class Inheritance
All Implemented Interfaces
com.sun.tools.javac.api.Messages
Imports
com.sun.tools.javac.api.Messages, .DiagnosticFormatter, java.lang.ref.SoftReference, java.util.ResourceBundle, .MissingResourceException, .HashMap, .Locale, .Map, java.text.MessageFormat, com.sun.tools.javac.util.JCDiagnostic.Factory, com.sun.tools.javac.resources.CompilerProperties.Errors

Support for formatted localized messages.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
JavacMessages.ResourceBundleHelper

This provides a way for the JavacMessager to retrieve a ResourceBundle from another module such as jdk.javadoc.

Field Summary

Modifier and TypeField and Description
private Map<Locale, SoftReference<List<ResourceBundle>>>
private List<JavacMessages.ResourceBundleHelper>
pack-priv Context
private List<ResourceBundle>
private Locale
private static ResourceBundle
private static final String
private static JavacMessages
private JCDiagnostic.Factory
private DiagnosticFormatter<JCDiagnostic>
public static final Context.Key<JavacMessages>
messagesKey

The context key for the JavacMessages object.

Constructor Summary

AccessConstructor and Description
public
JavacMessages(Context context)

Creates a JavacMessages object.

public
JavacMessages(String
the name to identify the resource bundle of localized messages.
bundleName
)

Creates a JavacMessages object.

public
JavacMessages(String
the name to identify the resource bundle of localized messages.
bundleName
,
Locale locale)

Creates a JavacMessages object.

public

Method Summary

Modifier and TypeMethod and Description
public void
add(String bundleName)

Implements com.sun.tools.javac.api.Messages.add.

Add a new resource bundle to the list that is searched for localized messages.

public void
public List<ResourceBundle>
public Locale
public static ResourceBundle
pack-priv static String
getDefaultLocalizedString(String key, Object... args)

Returns a localized string from the compiler's default bundle.

pack-priv static JavacMessages
getDefaultMessages()
Deprecated

pack-priv JCDiagnostic.Factory
public String
getLocalizedString(String key, Object... args)

Gets the localized string corresponding to a key, formatted with a set of args.

public String
public String
getLocalizedString(Locale l, String key, Object... args)

Implements com.sun.tools.javac.api.Messages.getLocalizedString.

Get a localized formatted string.

public String
private static String
private String
private void
public static JavacMessages
instance(Context context)

Get the JavacMessages instance for this context.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bundleCacheback to summary
private Map<Locale, SoftReference<List<ResourceBundle>>> bundleCache
bundleHelpersback to summary
private List<JavacMessages.ResourceBundleHelper> bundleHelpers
contextback to summary
pack-priv Context context
currentBundlesback to summary
private List<ResourceBundle> currentBundles
currentLocaleback to summary
private Locale currentLocale
defaultBundleback to summary
private static ResourceBundle defaultBundle
defaultBundleNameback to summary
private static final String defaultBundleName
defaultMessagesback to summary
private static JavacMessages defaultMessages
diagFactoryback to summary
private JCDiagnostic.Factory diagFactory
diagFormatterback to summary
private DiagnosticFormatter<JCDiagnostic> diagFormatter
messagesKeyback to summary
public static final Context.Key<JavacMessages> messagesKey

The context key for the JavacMessages object.

Constructor Detail

JavacMessagesback to summary
public JavacMessages(Context context)

Creates a JavacMessages object.

Annotations
@SuppressWarnings:this-escape
JavacMessagesback to summary
public JavacMessages(String bundleName) throws MissingResourceException

Creates a JavacMessages object.

Parameters
bundleName:String

the name to identify the resource bundle of localized messages.

JavacMessagesback to summary
public JavacMessages(String bundleName, Locale locale) throws MissingResourceException

Creates a JavacMessages object.

Parameters
bundleName:String

the name to identify the resource bundle of localized messages.

Annotations
@SuppressWarnings:this-escape
JavacMessagesback to summary
public JavacMessages() throws MissingResourceException

Method Detail

addback to summary
public void add(String bundleName) throws MissingResourceException

Implements com.sun.tools.javac.api.Messages.add.

Doc from com.sun.tools.javac.api.Messages.add.

Add a new resource bundle to the list that is searched for localized messages.

Annotations
@Override
Exceptions
MissingResourceException:
if the given resource is not found
addback to summary
public void add(JavacMessages.ResourceBundleHelper ma)
getBundlesback to summary
public List<ResourceBundle> getBundles(Locale locale)
getCurrentLocaleback to summary
public Locale getCurrentLocale()
getDefaultBundleback to summary
public static ResourceBundle getDefaultBundle()
getDefaultLocalizedStringback to summary
pack-priv static String getDefaultLocalizedString(String key, Object... args)

Returns a localized string from the compiler's default bundle.

getDefaultMessagesback to summary
pack-priv static JavacMessages getDefaultMessages()

Deprecated

Annotations
@Deprecated
getDiagFactoryback to summary
pack-priv JCDiagnostic.Factory getDiagFactory()
getLocalizedStringback to summary
public String getLocalizedString(String key, Object... args)

Gets the localized string corresponding to a key, formatted with a set of args.

getLocalizedStringback to summary
public String getLocalizedString(JCDiagnostic.DiagnosticInfo diagInfo)
getLocalizedStringback to summary
public String getLocalizedString(Locale l, String key, Object... args)

Implements com.sun.tools.javac.api.Messages.getLocalizedString.

Doc from com.sun.tools.javac.api.Messages.getLocalizedString.

Get a localized formatted string.

Annotations
@Override
getLocalizedStringback to summary
public String getLocalizedString(Locale l, JCDiagnostic.DiagnosticInfo diagInfo)
getLocalizedStringback to summary
private static String getLocalizedString(List<ResourceBundle> bundles, String key, Object... args)
getLocalizedStringback to summary
private String getLocalizedString(List<ResourceBundle> bundles, JCDiagnostic.DiagnosticInfo diagInfo)
initOptionsback to summary
private void initOptions(Options options)
instanceback to summary
public static JavacMessages instance(Context context)

Get the JavacMessages instance for this context.

setCurrentLocaleback to summary
public void setCurrentLocale(Locale locale)
com.sun.tools.javac.util back to summary

public Interface JavacMessages.ResourceBundleHelper


This provides a way for the JavacMessager to retrieve a ResourceBundle from another module such as jdk.javadoc.

Method Summary

Modifier and TypeMethod and Description
public ResourceBundle

Returns:

ResourceBundle
getResourceBundle
(Locale
the requested bundle's locale
locale
)

Gets the ResourceBundle.

Method Detail

getResourceBundleback to summary
public ResourceBundle getResourceBundle(Locale locale)

Gets the ResourceBundle.

Parameters
locale:Locale

the requested bundle's locale

Returns:ResourceBundle

ResourceBundle