protected boolean shouldDisplay( EvaluationContext context, @NotNull ObjectReference objInstance, @NotNull Field field) { final boolean isSynthetic = DebuggerUtils.isSynthetic(field); if (!SHOW_SYNTHETICS && isSynthetic) { return false; } if (SHOW_VAL_FIELDS_AS_LOCAL_VARIABLES && isSynthetic) { try { final StackFrameProxy frameProxy = context.getFrameProxy(); if (frameProxy != null) { final Location location = frameProxy.location(); if (location != null && objInstance.equals(context.getThisObject()) && Comparing.equal(objInstance.referenceType(), location.declaringType()) && StringUtil.startsWith( field.name(), FieldDescriptorImpl.OUTER_LOCAL_VAR_FIELD_PREFIX)) { return false; } } } catch (EvaluateException ignored) { } } if (!SHOW_STATIC && field.isStatic()) { return false; } if (!SHOW_STATIC_FINAL && field.isStatic() && field.isFinal()) { return false; } return true; }
/** * Parses a field type definition * * @param docField * @return */ protected static Field ParseField(FieldDoc docField) { assert (docField != null); Field xmlField = new Field(); xmlField.name = docField.name(); xmlField.comment = docField.commentText(); xmlField.type = ParseType(docField.type()); xmlField.isFinal = docField.isFinal(); if (xmlField.isFinal) { xmlField.finalExpression = docField.constantValueExpression(); } else if (docField.constantValueExpression() != null) { // how would a non-final field have a constant value expression? // my understanding is that this field is only != null when is not final assert (false); } xmlField.isStatic = docField.isStatic(); xmlField.isVolatile = docField.isVolatile(); xmlField.isTransient = docField.isTransient(); xmlField.scope = DetermineScope(docField); // parse annotations from the field xmlField.annotationInstances = ParseAnnotationInstances(docField.annotations(), docField.qualifiedName()); return xmlField; }
public FieldDescriptorImpl(Project project, ObjectReference objRef, @NotNull Field field) { super(project); myObject = objRef; myField = field; myIsStatic = field.isStatic(); setLvalue(!field.isFinal()); }
private void importField(DbJVClass dbClaz, Field field) throws DbException { if (dbClaz == null) { return; } DbJVDataMember member = new DbJVDataMember(dbClaz); member.setName(field.getName()); // set field type Type type = field.getType(); member.setType(toAdt(type)); member.setTypeUse(toTypeUse(type)); // set field modifiers member.setFinal(field.isFinal()); member.setStatic(field.isStatic()); member.setTransient(field.isTransient()); member.setVisibility(toVisibility(field)); member.setVolatile(field.isVolatile()); }
public void setValue(Field field, Value value) throws InvalidTypeException, ClassNotLoadedException { validateMirror(field); validateMirrorOrNull(value); validateFieldSet(field); // More validation specific to setting from a ClassType if (!field.isStatic()) { throw new IllegalArgumentException("Must set non-static field through an instance"); } try { JDWP.ClassType.SetValues.FieldValue[] values = new JDWP.ClassType.SetValues.FieldValue[1]; values[0] = new JDWP.ClassType.SetValues.FieldValue( ((FieldImpl) field).ref(), // validate and convert if necessary ValueImpl.prepareForAssignment(value, (FieldImpl) field)); try { JDWP.ClassType.SetValues.process(vm, this, values); } catch (JDWPException exc) { throw exc.toJDIException(); } } catch (ClassNotLoadedException e) { /* * Since we got this exception, * the field type must be a reference type. The value * we're trying to set is null, but if the field's * class has not yet been loaded through the enclosing * class loader, then setting to null is essentially a * no-op, and we should allow it without an exception. */ if (value != null) { throw e; } } }