List of usage examples for org.eclipse.jdt.internal.compiler.classfmt ClassFileReader hasStructuralChanges
public boolean hasStructuralChanges(byte[] newBytes)
From source file:com.google.gwt.dev.javac.Dependencies.java
License:Apache License
private boolean hasStructuralChanges(CompiledClass mine, CompiledClass theirs) { try {/*from ww w. j a v a 2 s . c om*/ ClassFileReader cfr = new ClassFileReader(theirs.getBytes(), null); return cfr.hasStructuralChanges(mine.getBytes()); } catch (ClassFormatException e) { throw new RuntimeException("Unexpected error reading compiled class", e); } }
From source file:net.sf.j2s.core.builder.IncrementalImageBuilder.java
License:Open Source License
protected boolean writeClassFileCheck(IFile file, String fileName, byte[] newBytes) throws CoreException { try {/*from w w w . j a v a2s . co m*/ byte[] oldBytes = Util.getResourceContentsAsByteArray(file); notEqual: if (newBytes.length == oldBytes.length) { for (int i = newBytes.length; --i >= 0;) if (newBytes[i] != oldBytes[i]) break notEqual; return false; // bytes are identical so skip them } URI location = file.getLocationURI(); if (location == null) return false; // unable to determine location of this class file String filePath = location.getSchemeSpecificPart(); ClassFileReader reader = new ClassFileReader(oldBytes, filePath.toCharArray()); // ignore local types since they're only visible inside a single method if (!(reader.isLocal() || reader.isAnonymous()) && reader.hasStructuralChanges(newBytes)) { if (JavaBuilder.DEBUG) System.out.println("Type has structural changes " + fileName); //$NON-NLS-1$ addDependentsOf(new Path(fileName), true); this.newState.wasStructurallyChanged(fileName); } } catch (ClassFormatException e) { addDependentsOf(new Path(fileName), true); this.newState.wasStructurallyChanged(fileName); } return true; }