1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 16:55:38 +02:00

Cosmetics.

Change-Id: Ib2caefa5406ea94fe1eec61138193c79fd0f608b
This commit is contained in:
Sergey Prigogin 2015-12-18 17:39:14 -08:00
parent 07488984d9
commit 2356094497
3 changed files with 44 additions and 46 deletions

View file

@ -44,14 +44,14 @@ import org.eclipse.core.runtime.CoreException;
public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding { public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding {
public static final PDOMBinding[] EMPTY_PDOMBINDING_ARRAY = {}; public static final PDOMBinding[] EMPTY_PDOMBINDING_ARRAY = {};
private static final int FIRST_DECL_OFFSET = PDOMNamedNode.RECORD_SIZE + 0; // size 4 private static final int FIRST_DECL_OFFSET = PDOMNamedNode.RECORD_SIZE; // size 4
private static final int FIRST_DEF_OFFSET = PDOMNamedNode.RECORD_SIZE + 4; // size 4 private static final int FIRST_DEF_OFFSET = FIRST_DECL_OFFSET + Database.PTR_SIZE; // size 4
private static final int FIRST_REF_OFFSET = PDOMNamedNode.RECORD_SIZE + 8; // size 4 private static final int FIRST_REF_OFFSET = FIRST_DEF_OFFSET + Database.PTR_SIZE; // size 4
private static final int LOCAL_TO_FILE = PDOMNamedNode.RECORD_SIZE + 12; // size 4 private static final int LOCAL_TO_FILE = FIRST_REF_OFFSET + Database.PTR_SIZE; // size 4
private static final int FIRST_EXTREF_OFFSET = PDOMNamedNode.RECORD_SIZE + 16; // size 4 private static final int FIRST_EXTREF_OFFSET = LOCAL_TO_FILE + Database.PTR_SIZE; // size 4
@SuppressWarnings("hiding") @SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMNamedNode.RECORD_SIZE + 20; protected static final int RECORD_SIZE = FIRST_EXTREF_OFFSET + + Database.PTR_SIZE;
private byte hasDeclaration= -1; private byte hasDeclaration= -1;
@ -64,10 +64,10 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
} }
@Override @Override
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings("unchecked")
public Object getAdapter(Class adapter) { public <T> T getAdapter(Class<T> adapter) {
if (adapter.isAssignableFrom(PDOMBinding.class)) if (adapter.isAssignableFrom(PDOMBinding.class))
return this; return (T) this;
// Any PDOMBinding can have a persistent tag. These tags should be deleted when // Any PDOMBinding can have a persistent tag. These tags should be deleted when
// the PDOMBinding is deleted. However, PDOMBinding's don't get deleted, so there is no way // the PDOMBinding is deleted. However, PDOMBinding's don't get deleted, so there is no way
@ -76,7 +76,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
// PDOMTagIndex.setTags(getPDOM(), pdomBinding.record, Collections.<ITag>emptyList()); // PDOMTagIndex.setTags(getPDOM(), pdomBinding.record, Collections.<ITag>emptyList());
// to clear out all tags for the binding. // to clear out all tags for the binding.
if (adapter.isAssignableFrom(ITagReader.class)) if (adapter.isAssignableFrom(ITagReader.class))
return new PDOMTaggable(getPDOM(), getRecord()); return (T) new PDOMTaggable(getPDOM(), getRecord());
return null; return null;
} }
@ -88,7 +88,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
* *
* @param pdom * @param pdom
* @param record * @param record
* @return <code>true</code> if the binding is orphaned. * @return {@code true} if the binding is orphaned.
* @throws CoreException * @throws CoreException
*/ */
public static boolean isOrphaned(PDOM pdom, long record) throws CoreException { public static boolean isOrphaned(PDOM pdom, long record) throws CoreException {
@ -313,7 +313,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
* For debug purposes only. * For debug purposes only.
* @param linkage * @param linkage
* @param value * @param value
* @return String representation of <code>value</code>. * @return String representation of {@code value}.
*/ */
protected static String getConstantNameForValue(PDOMLinkage linkage, int value) { protected static String getConstantNameForValue(PDOMLinkage linkage, int value) {
Class<? extends PDOMLinkage> c= linkage.getClass(); Class<? extends PDOMLinkage> c= linkage.getClass();
@ -328,9 +328,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
return field.getName(); return field.getName();
} }
} }
} catch (IllegalAccessException e) { } catch (IllegalAccessException | IllegalArgumentException e) {
continue;
} catch (IllegalArgumentException e) {
continue; continue;
} }
} }
@ -402,8 +400,8 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
} }
} while (cmp == 0 && b1 != null && b0 != null); } while (cmp == 0 && b1 != null && b0 != null);
return cmp; return cmp;
} catch (CoreException ce) { } catch (CoreException e) {
CCorePlugin.log(ce); CCorePlugin.log(e);
return -1; return -1;
} }
} }

View file

@ -35,7 +35,7 @@ public abstract class PDOMNamedNode extends PDOMNode {
* The size in bytes of a PDOMNamedNode record in the database. * The size in bytes of a PDOMNamedNode record in the database.
*/ */
@SuppressWarnings("hiding") @SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMNode.RECORD_SIZE + 4; protected static final int RECORD_SIZE = PDOMNode.RECORD_SIZE + Database.PTR_SIZE;
private volatile char[] fName; private volatile char[] fName;

View file

@ -27,10 +27,10 @@ import org.eclipse.core.runtime.CoreException;
*/ */
public abstract class PDOMNode implements IInternalPDOMNode { public abstract class PDOMNode implements IInternalPDOMNode {
private static final int FACTORY_ID = 0; private static final int FACTORY_ID = 0;
private static final int NODE_TYPE = 2; private static final int NODE_TYPE = FACTORY_ID + 2;
private static final int PARENT = 4; private static final int PARENT = NODE_TYPE + 2;
protected static final int RECORD_SIZE = 8; protected static final int RECORD_SIZE = PARENT + Database.PTR_SIZE;
private final PDOMLinkage fLinkage; private final PDOMLinkage fLinkage;
protected final long record; protected final long record;