List of usage examples for org.eclipse.jdt.core IClasspathEntry CPE_LIBRARY
int CPE_LIBRARY
To view the source code for org.eclipse.jdt.core IClasspathEntry CPE_LIBRARY.
Click Source Link
From source file:org.eclipse.fx.ide.ui.preview.LivePreviewSynchronizer.java
License:Open Source License
private void resolveDataProject(IJavaProject project, Set<IPath> outputPath, Set<IPath> listRefLibraries) { // System.err.println("START RESOLVE: " + project.getElementName()); try {/*from w w w .j a v a 2s .c om*/ IClasspathEntry[] entries = project.getRawClasspath(); outputPath.add(project.getOutputLocation()); for (IClasspathEntry e : entries) { // System.err.println(e + " ====> " + e.getEntryKind()); if (e.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(e.getPath().lastSegment()); if (p.exists()) { resolveDataProject(JavaCore.create(p), outputPath, listRefLibraries); } } else if (e.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { // System.err.println("CPE_LIBRARY PUSHING: " + e.getPath()); listRefLibraries.add(e.getPath()); } else if ("org.eclipse.pde.core.requiredPlugins".equals(e.getPath().toString())) { IClasspathContainer cpContainer = JavaCore.getClasspathContainer(e.getPath(), project); for (IClasspathEntry cpEntry : cpContainer.getClasspathEntries()) { if (cpEntry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IProject p = ResourcesPlugin.getWorkspace().getRoot() .getProject(cpEntry.getPath().lastSegment()); if (p.exists()) { resolveDataProject(JavaCore.create(p), outputPath, listRefLibraries); } } else if (cpEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { // System.err.println("requiredPlugins & CPE_LIBRARY PUSHING: " + e.getPath()); listRefLibraries.add(cpEntry.getPath()); } } } else if (e.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { if (!e.getPath().toString().startsWith("org.eclipse.jdt.launching.JRE_CONTAINER") && !e.getPath().toString().startsWith("org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER")) { // System.err.println("====> A container"); IClasspathContainer cp = JavaCore.getClasspathContainer(e.getPath(), project); for (IClasspathEntry ce : cp.getClasspathEntries()) { // System.err.println(ce.getEntryKind() + "=> " + ce); if (ce.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { listRefLibraries.add(ce.getPath()); } else if (ce.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IProject p = ResourcesPlugin.getWorkspace().getRoot() .getProject(ce.getPath().lastSegment()); if (p.exists()) { resolveDataProject(JavaCore.create(p), outputPath, listRefLibraries); } } } } } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } // System.err.println("END RESOLVE"); }
From source file:org.eclipse.imp.java.hosted.ProjectUtils.java
License:Open Source License
public void addExtenderForJavaHostedProjects(Language lang) { ModelFactory.getInstance().installExtender(new IFactoryExtender() { public void extend(ISourceProject project) { initializeBuildPathFromJavaProject(project); }/* w w w . ja va 2 s . co m*/ public void extend(ICompilationUnit unit) { } /** * Read the IJavaProject classpath configuration and populate the ISourceProject's * build path accordingly. */ public void initializeBuildPathFromJavaProject(ISourceProject project) { IJavaProject javaProject = JavaCore.create(project.getRawProject()); if (javaProject.exists()) { try { IClasspathEntry[] cpEntries = javaProject.getResolvedClasspath(true); List<IPathEntry> buildPath = new ArrayList<IPathEntry>(cpEntries.length); for (int i = 0; i < cpEntries.length; i++) { IClasspathEntry entry = cpEntries[i]; IPathEntry.PathEntryType type; IPath path = entry.getPath(); switch (entry.getEntryKind()) { case IClasspathEntry.CPE_CONTAINER: type = PathEntryType.CONTAINER; break; case IClasspathEntry.CPE_LIBRARY: type = PathEntryType.ARCHIVE; break; case IClasspathEntry.CPE_PROJECT: type = PathEntryType.PROJECT; break; case IClasspathEntry.CPE_SOURCE: type = PathEntryType.SOURCE_FOLDER; break; default: // case IClasspathEntry.CPE_VARIABLE: throw new IllegalArgumentException("Encountered variable class-path entry: " + entry.getPath().toPortableString()); } IPathEntry pathEntry = ModelFactory.createPathEntry(type, path); buildPath.add(pathEntry); } project.setBuildPath(buildPath); } catch (JavaModelException e) { ErrorHandler.reportError(e.getMessage(), e); } } } }, lang); }
From source file:org.eclipse.jdt.internal.core.JavaModelManager.java
License:Open Source License
private Set getNonChainingJarsCache() throws CoreException { // Even if there is one entry in the cache, just return it. It may not be // the complete cache, but avoid going through all the projects to populate the cache. if (this.nonChainingJars != null && this.nonChainingJars.size() > 0) { return this.nonChainingJars; }/*from w ww . jav a 2 s . c o m*/ Set result = new HashSet(); IJavaProject[] projects = getJavaModel().getJavaProjects(); for (int i = 0, length = projects.length; i < length; i++) { IJavaProject javaProject = projects[i]; IClasspathEntry[] classpath = ((JavaProject) javaProject).getResolvedClasspath(); for (int j = 0, length2 = classpath.length; j < length2; j++) { IClasspathEntry entry = classpath[j]; IPath path; if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && !result.contains(path = entry.getPath()) && ClasspathEntry.resolvedChainedLibraries(path).length == 0) { result.add(path); } } } this.nonChainingJars = Collections.synchronizedSet(result); return this.nonChainingJars; }
From source file:org.eclipse.jdt.internal.core.JavaProject.java
License:Open Source License
/** * Returns the package fragment roots identified by the given entry. In case it refers to * a project, it will follow its classpath so as to find exported roots as well. * Only works with resolved entry/*from w w w . j av a2 s . co m*/ * @param resolvedEntry IClasspathEntry * @param accumulatedRoots ObjectVector * @param rootIDs HashSet * @param referringEntry the CP entry (project) referring to this entry, or null if initial project * @param retrieveExportedRoots boolean * @throws JavaModelException */ public void computePackageFragmentRoots(IClasspathEntry resolvedEntry, ObjectVector accumulatedRoots, HashSet rootIDs, IClasspathEntry referringEntry, boolean retrieveExportedRoots, Map rootToResolvedEntries) throws JavaModelException { String rootID = ((ClasspathEntry) resolvedEntry).rootID(); if (rootIDs.contains(rootID)) return; IPath projectPath = this.project.getFullPath(); IPath entryPath = resolvedEntry.getPath(); IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IPackageFragmentRoot root = null; switch (resolvedEntry.getEntryKind()) { // source folder case IClasspathEntry.CPE_SOURCE: if (projectPath.isPrefixOf(entryPath)) { Object target = JavaModel.getTarget(entryPath, true/*check existency*/); if (target == null) return; if (target instanceof IFolder || target instanceof IProject) { root = getPackageFragmentRoot((IResource) target); } } break; // internal/external JAR or folder case IClasspathEntry.CPE_LIBRARY: if (referringEntry != null && !resolvedEntry.isExported()) return; Object target = JavaModel.getTarget(entryPath, true/*check existency*/); if (target == null) return; if (target instanceof IResource) { // internal target root = getPackageFragmentRoot((IResource) target, entryPath); } else if (target instanceof File) { // external target if (JavaModel.isFile(target)) { root = new JarPackageFragmentRoot(entryPath, this); } else if (((File) target).isDirectory()) { root = new ExternalPackageFragmentRoot(entryPath, this); } } break; // recurse into required project case IClasspathEntry.CPE_PROJECT: if (!retrieveExportedRoots) return; if (referringEntry != null && !resolvedEntry.isExported()) return; IResource member = workspaceRoot.findMember(entryPath); if (member != null && member.getType() == IResource.PROJECT) {// double check if bound to project (23977) IProject requiredProjectRsc = (IProject) member; if (JavaProject.hasJavaNature(requiredProjectRsc)) { // special builder binary output rootIDs.add(rootID); JavaProject requiredProject = (JavaProject) JavaCore.create(requiredProjectRsc); requiredProject.computePackageFragmentRoots(requiredProject.getResolvedClasspath(), accumulatedRoots, rootIDs, rootToResolvedEntries == null ? resolvedEntry : ((ClasspathEntry) resolvedEntry).combineWith((ClasspathEntry) referringEntry), // only combine if need to build the reverse map retrieveExportedRoots, rootToResolvedEntries); } break; } } if (root != null) { accumulatedRoots.add(root); rootIDs.add(rootID); if (rootToResolvedEntries != null) rootToResolvedEntries.put(root, ((ClasspathEntry) resolvedEntry).combineWith((ClasspathEntry) referringEntry)); } }
From source file:org.eclipse.jdt.internal.core.JavaProject.java
License:Open Source License
public boolean contains(IResource resource) { IClasspathEntry[] classpath;/* w w w .j av a2 s .c o m*/ IPath output; try { classpath = getResolvedClasspath(); output = getOutputLocation(); } catch (JavaModelException e) { return false; } IPath fullPath = resource.getFullPath(); IPath innerMostOutput = output.isPrefixOf(fullPath) ? output : null; IClasspathEntry innerMostEntry = null; ExternalFoldersManager foldersManager = JavaModelManager.getExternalManager(); for (int j = 0, cpLength = classpath.length; j < cpLength; j++) { IClasspathEntry entry = classpath[j]; IPath entryPath = entry.getPath(); if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { IResource linkedFolder = foldersManager.getFolder(entryPath); if (linkedFolder != null) entryPath = linkedFolder.getFullPath(); } if ((innerMostEntry == null || innerMostEntry.getPath().isPrefixOf(entryPath)) && entryPath.isPrefixOf(fullPath)) { innerMostEntry = entry; } IPath entryOutput = classpath[j].getOutputLocation(); if (entryOutput != null && entryOutput.isPrefixOf(fullPath)) { innerMostOutput = entryOutput; } } if (innerMostEntry != null) { // special case prj==src and nested output location if (innerMostOutput != null && innerMostOutput.segmentCount() > 1 // output isn't project && innerMostEntry.getPath().segmentCount() == 1) { // 1 segment must be project name return false; } if (resource instanceof IFolder) { // folders are always included in src/lib entries return true; } switch (innerMostEntry.getEntryKind()) { case IClasspathEntry.CPE_SOURCE: // .class files are not visible in source folders return !org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(fullPath.lastSegment()); case IClasspathEntry.CPE_LIBRARY: // .java files are not visible in library folders return !org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(fullPath.lastSegment()); } } if (innerMostOutput != null) { return false; } return true; }
From source file:org.eclipse.jdt.internal.core.JavaProject.java
License:Open Source License
public boolean isOnClasspath(IJavaElement element) { IClasspathEntry[] rawClasspath;// w w w. j a v a2s .c om try { rawClasspath = getRawClasspath(); } catch (JavaModelException e) { return false; // not a Java project } int elementType = element.getElementType(); boolean isPackageFragmentRoot = false; boolean isFolderPath = false; boolean isSource = false; switch (elementType) { case IJavaElement.JAVA_MODEL: return false; case IJavaElement.JAVA_PROJECT: break; case IJavaElement.PACKAGE_FRAGMENT_ROOT: isPackageFragmentRoot = true; break; case IJavaElement.PACKAGE_FRAGMENT: isFolderPath = !((IPackageFragmentRoot) element.getParent()).isArchive(); break; case IJavaElement.COMPILATION_UNIT: isSource = true; break; default: isSource = element.getAncestor(IJavaElement.COMPILATION_UNIT) != null; break; } IPath elementPath = element.getPath(); // first look at unresolved entries int length = rawClasspath.length; for (int i = 0; i < length; i++) { IClasspathEntry entry = rawClasspath[i]; switch (entry.getEntryKind()) { case IClasspathEntry.CPE_LIBRARY: case IClasspathEntry.CPE_PROJECT: case IClasspathEntry.CPE_SOURCE: if (isOnClasspathEntry(elementPath, isFolderPath, isPackageFragmentRoot, entry)) return true; break; } } // no need to go further for compilation units and elements inside a compilation unit // it can only be in a source folder, thus on the raw classpath if (isSource) return false; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=304081 // All the resolved classpath entries need to be considered, including the referenced classpath entries IClasspathEntry[] resolvedClasspath = null; try { resolvedClasspath = getResolvedClasspath(); } catch (JavaModelException e) { return false; // Perhaps, not a Java project } for (int index = 0; index < resolvedClasspath.length; index++) { if (isOnClasspathEntry(elementPath, isFolderPath, isPackageFragmentRoot, resolvedClasspath[index])) return true; } return false; }
From source file:org.eclipse.jdt.internal.core.JavaProject.java
License:Open Source License
public ResolvedClasspath resolveClasspath(IClasspathEntry[] rawClasspath, IClasspathEntry[] referencedEntries, boolean usePreviousSession, boolean resolveChainedLibraries) throws JavaModelException { JavaModelManager manager = JavaModelManager.getJavaModelManager(); ExternalFoldersManager externalFoldersManager = JavaModelManager.getExternalManager(); ResolvedClasspath result = new ResolvedClasspath(); Map knownDrives = new HashMap(); Map referencedEntriesMap = new HashMap(); List rawLibrariesPath = new ArrayList(); LinkedHashSet resolvedEntries = new LinkedHashSet(); if (resolveChainedLibraries) { for (int index = 0; index < rawClasspath.length; index++) { IClasspathEntry currentEntry = rawClasspath[index]; if (currentEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { rawLibrariesPath/*from w w w. jav a 2 s . c o m*/ .add(ClasspathEntry.resolveDotDot(getProject().getLocation(), currentEntry.getPath())); } } if (referencedEntries != null) { // The Set is required to keep the order intact while the referencedEntriesMap (Map) // is used to map the referenced entries with path LinkedHashSet referencedEntriesSet = new LinkedHashSet(); for (int index = 0; index < referencedEntries.length; index++) { IPath path = referencedEntries[index].getPath(); if (!rawLibrariesPath.contains(path) && referencedEntriesMap.get(path) == null) { referencedEntriesMap.put(path, referencedEntries[index]); referencedEntriesSet.add(referencedEntries[index]); } } if (referencedEntriesSet.size() > 0) { result.referencedEntries = new IClasspathEntry[referencedEntriesSet.size()]; referencedEntriesSet.toArray(result.referencedEntries); } } } int length = rawClasspath.length; for (int i = 0; i < length; i++) { IClasspathEntry rawEntry = rawClasspath[i]; IClasspathEntry resolvedEntry = rawEntry; switch (rawEntry.getEntryKind()) { case IClasspathEntry.CPE_VARIABLE: try { resolvedEntry = manager.resolveVariableEntry(rawEntry, usePreviousSession); } catch (ClasspathEntry.AssertionFailedException e) { // Catch the assertion failure and set status instead // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=55992 result.unresolvedEntryStatus = new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, e.getMessage()); break; } if (resolvedEntry == null) { result.unresolvedEntryStatus = new JavaModelStatus( IJavaModelStatusConstants.CP_VARIABLE_PATH_UNBOUND, this, rawEntry.getPath()); } else { // If the entry is already present in the rawReversetMap, it means the entry and the chained libraries // have already been processed. So, skip it. if (resolveChainedLibraries && resolvedEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && result.rawReverseMap.get(resolvedEntry.getPath()) == null) { // resolve Class-Path: in manifest ClasspathEntry[] extraEntries = ((ClasspathEntry) resolvedEntry).resolvedChainedLibraries(); for (int j = 0, length2 = extraEntries.length; j < length2; j++) { if (!rawLibrariesPath.contains(extraEntries[j].getPath())) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305037 // referenced entries for variable entries could also be persisted with extra attributes, so addAsChainedEntry = true addToResult(rawEntry, extraEntries[j], result, resolvedEntries, externalFoldersManager, referencedEntriesMap, true, knownDrives); } } } addToResult(rawEntry, resolvedEntry, result, resolvedEntries, externalFoldersManager, referencedEntriesMap, false, knownDrives); } break; case IClasspathEntry.CPE_CONTAINER: IClasspathContainer container = usePreviousSession ? manager.getPreviousSessionContainer(rawEntry.getPath(), this) : JavaCore.getClasspathContainer(rawEntry.getPath(), this); if (container == null) { result.unresolvedEntryStatus = new JavaModelStatus( IJavaModelStatusConstants.CP_CONTAINER_PATH_UNBOUND, this, rawEntry.getPath()); break; } IClasspathEntry[] containerEntries = container.getClasspathEntries(); if (containerEntries == null) { if (JavaModelManager.CP_RESOLVE_VERBOSE || JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) { JavaModelManager.getJavaModelManager().verbose_missbehaving_container_null_entries(this, rawEntry.getPath()); } break; } // container was bound for (int j = 0, containerLength = containerEntries.length; j < containerLength; j++) { ClasspathEntry cEntry = (ClasspathEntry) containerEntries[j]; if (cEntry == null) { if (JavaModelManager.CP_RESOLVE_VERBOSE || JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) { JavaModelManager.getJavaModelManager().verbose_missbehaving_container(this, rawEntry.getPath(), containerEntries); } break; } // if container is exported or restricted, then its nested entries must in turn be exported (21749) and/or propagate restrictions cEntry = cEntry.combineWith((ClasspathEntry) rawEntry); if (cEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { // resolve ".." in library path cEntry = cEntry.resolvedDotDot(getProject().getLocation()); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=313965 // Do not resolve if the system attribute is set to false if (resolveChainedLibraries && JavaModelManager.getJavaModelManager().resolveReferencedLibrariesForContainers && result.rawReverseMap.get(cEntry.getPath()) == null) { // resolve Class-Path: in manifest ClasspathEntry[] extraEntries = cEntry.resolvedChainedLibraries(); for (int k = 0, length2 = extraEntries.length; k < length2; k++) { if (!rawLibrariesPath.contains(extraEntries[k].getPath())) { addToResult(rawEntry, extraEntries[k], result, resolvedEntries, externalFoldersManager, referencedEntriesMap, false, knownDrives); } } } } addToResult(rawEntry, cEntry, result, resolvedEntries, externalFoldersManager, referencedEntriesMap, false, knownDrives); } break; case IClasspathEntry.CPE_LIBRARY: // resolve ".." in library path resolvedEntry = ((ClasspathEntry) rawEntry).resolvedDotDot(getProject().getLocation()); if (resolveChainedLibraries && result.rawReverseMap.get(resolvedEntry.getPath()) == null) { // resolve Class-Path: in manifest ClasspathEntry[] extraEntries = ((ClasspathEntry) resolvedEntry).resolvedChainedLibraries(); for (int k = 0, length2 = extraEntries.length; k < length2; k++) { if (!rawLibrariesPath.contains(extraEntries[k].getPath())) { addToResult(rawEntry, extraEntries[k], result, resolvedEntries, externalFoldersManager, referencedEntriesMap, true, knownDrives); } } } addToResult(rawEntry, resolvedEntry, result, resolvedEntries, externalFoldersManager, referencedEntriesMap, false, knownDrives); break; default: addToResult(rawEntry, resolvedEntry, result, resolvedEntries, externalFoldersManager, referencedEntriesMap, false, knownDrives); break; } } result.resolvedClasspath = new IClasspathEntry[resolvedEntries.size()]; resolvedEntries.toArray(result.resolvedClasspath); return result; }
From source file:org.eclipse.jdt.internal.core.JavaProject.java
License:Open Source License
private void addToResult(IClasspathEntry rawEntry, IClasspathEntry resolvedEntry, ResolvedClasspath result, LinkedHashSet resolvedEntries, ExternalFoldersManager externalFoldersManager, Map oldChainedEntriesMap, boolean addAsChainedEntry, Map knownDrives) { IPath resolvedPath;//from w ww .java 2 s. co m // If it's already been resolved, do not add to resolvedEntries if (result.rawReverseMap.get(resolvedPath = resolvedEntry.getPath()) == null) { result.rawReverseMap.put(resolvedPath, rawEntry); result.rootPathToResolvedEntries.put(resolvedPath, resolvedEntry); resolvedEntries.add(resolvedEntry); if (addAsChainedEntry) { IClasspathEntry chainedEntry = null; chainedEntry = (ClasspathEntry) oldChainedEntriesMap.get(resolvedPath); if (chainedEntry != null) { // This is required to keep the attributes if any added by the user in // the previous session such as source attachment path etc. copyFromOldChainedEntry((ClasspathEntry) resolvedEntry, (ClasspathEntry) chainedEntry); } } } if (resolvedEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && ExternalFoldersManager.isExternalFolderPath(resolvedPath)) { externalFoldersManager.addFolder(resolvedPath, true/*scheduleForCreation*/); // no-op if not an external folder or if already registered } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=336046 // The source attachment path could be external too and in which case, must be added. IPath sourcePath = resolvedEntry.getSourceAttachmentPath(); if (sourcePath != null && driveExists(sourcePath, knownDrives) && ExternalFoldersManager.isExternalFolderPath(sourcePath)) { externalFoldersManager.addFolder(sourcePath, true); } }
From source file:org.eclipse.jdt.internal.core.search.indexing.IndexManager.java
License:Open Source License
/** * Trigger addition of the entire content of a project * Note: the actual operation is performed in background */// www. j av a 2s . c om public void indexAll(IProject project) { if (JavaCore.getPlugin() == null) return; // Also request indexing of binaries on the classpath // determine the new children try { JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel(); JavaProject javaProject = (JavaProject) model.getJavaProject(project); // only consider immediate libraries - each project will do the same // NOTE: force to resolve CP variables before calling indexer - 19303, so that initializers // will be run in the current thread. IClasspathEntry[] entries = javaProject.getResolvedClasspath(); for (int i = 0; i < entries.length; i++) { IClasspathEntry entry = entries[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) indexLibrary(entry.getPath(), project); } } catch (JavaModelException e) { // cannot retrieve classpath info } // check if the same request is not already in the queue IndexRequest request = new IndexAllProject(project, this); if (!isJobWaiting(request)) request(request); }
From source file:org.eclipse.jem.internal.beaninfo.core.BeaninfoEntry.java
License:Open Source License
static int kindFromString(String kindStr) { if (kindStr == null || kindStr.length() == 0) return BIE_PLUGIN; // Default to plugin. If coming from beaninfoconfig, there should always be kind. But if coming from plugin.xml there shouldn't be one. if (kindStr.equalsIgnoreCase("con")) //$NON-NLS-1$ return IClasspathEntry.CPE_CONTAINER; if (kindStr.equalsIgnoreCase("var")) //$NON-NLS-1$ return IClasspathEntry.CPE_VARIABLE; if (kindStr.equalsIgnoreCase("src")) //$NON-NLS-1$ return IClasspathEntry.CPE_SOURCE; if (kindStr.equalsIgnoreCase("lib")) //$NON-NLS-1$ return IClasspathEntry.CPE_LIBRARY; if (kindStr.equalsIgnoreCase("plugin")) //$NON-NLS-1$ return BIE_PLUGIN; return -1;// www. java 2 s. c om }