Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: third_party/jmake/src/org/pantsbuild/jmake/PCDEntry.java

Issue 1373723003: Fix javac --incremental by using jmake for dependency analysis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aidl
Patch Set: fix license check Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
2 *
3 * This program is distributed under the terms of
4 * the GNU General Public License Version 2. See the LICENSE file
5 * at the top of the source tree.
6 */
7 package org.pantsbuild.jmake;
8
9 import java.io.File;
10
11 /**
12 * An instance of this class represents an entry in the Project Class Directory.
13 *
14 * @author Misha Dmitriev
15 * 29 March 2002
16 */
17 public class PCDEntry {
18 // Class versions compare results
19
20 static final int CV_UNCHECKED = 0;
21 static final int CV_COMPATIBLE = 1;
22 static final int CV_INCOMPATIBLE = 2;
23 static final int CV_DELETED = 3;
24 static final int CV_NEW = 4;
25 static final int CV_NEWER_FOUND_NEARER = 5;
26 String className; // Dots are replaced with slashes for convenienc e
27 transient String classFileFullPath;
28 String javaFileFullPath;
29 long oldClassFileLastModified;
30 transient long newClassFileLastModified;
31 long oldClassFileFingerprint;
32 transient long newClassFileFingerprint;
33 ClassInfo oldClassInfo;
34 transient ClassInfo newClassInfo;
35 transient int checkResult; // Reflects the result of class version c omparison
36 transient boolean checked; // Mark entries for classes that have been checked and found existing.
37 // It helps to detect double entries for the same class in the project file list,
38 // and also not to confuse them with the case when a .java source for a clas s is moved.
39
40 /** This constructor is called to initialize a record for a class that has j ust been added to the project. */
41 public PCDEntry(String className,
42 String javaFileFullPath,
43 String classFileFullPath,
44 long classFileLastModified,
45 long classFileFingerprint,
46 ClassInfo classInfo) {
47 this.className = className;
48 this.classFileFullPath = classFileFullPath;
49 this.javaFileFullPath = javaFileFullPath;
50 this.oldClassFileLastModified = this.newClassFileLastModified =
51 classFileLastModified;
52 this.oldClassFileFingerprint = this.newClassFileFingerprint =
53 classFileFingerprint;
54 this.newClassInfo = classInfo;
55 checked = true;
56 }
57
58 /**
59 * This constructor is called to initialize a record for a class that
60 * exists at least in the previous version of the project.
61 */
62 public PCDEntry(String className,
63 String javaFileFullPath,
64 long classFileLastModified,
65 long classFileFingerprint,
66 ClassInfo classInfo) {
67 this.className = className;
68 this.javaFileFullPath = javaFileFullPath;
69 this.oldClassFileLastModified = classFileLastModified;
70 this.oldClassFileFingerprint = classFileFingerprint;
71 this.oldClassInfo = classInfo;
72 }
73
74 // Debugging
75 public String toString() {
76 return "className = " + className +
77 "; classFileFullPath = " + classFileFullPath +
78 "; javaFileFullPath = " + javaFileFullPath;
79 }
80
81 /**
82 * Returns the name of the class that corresponds to the file name, i.e. the public class
83 */
84 private String getExpectedClassName() {
85 File path = new File(javaFileFullPath);
86 int index = -1;
87 do {
88 index = className.indexOf('/', index + 1);
89 path = path.getParentFile();
90 } while (index != -1);
91 String pathString = path.toString();
92 if (!pathString.endsWith("/"))
93 pathString += "/";
94 // It is assumed that the javaFileFillPath ends with .java
95 int javaPathWithoutSuffix = javaFileFullPath.length() - 5;
96 return javaFileFullPath.substring(pathString.length(),
97 javaPathWithoutSuffix);
98 }
99
100 /**
101 * A class that neither has the same name as the java file, nor an inner cla ss, is
102 * package-private.
103 */
104 public boolean isPackagePrivateClass() {
105 String expectedClassName = getExpectedClassName();
106
107 return !(className.equals(expectedClassName)
108 || (className.startsWith(expectedClassName)
109 && className.charAt(expectedClassName.length()) == '$'));
110 }
111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698