Java SE 6或Java SE 7中是否存在非final字段

时间:2013-06-23 01:38:07

标签: java field final mutable

在SE 6或SE 7的任何类别中,是否有任何一个非最终的字段,即可以直接设置的字段?

我正在研究从另一种语言(Haskell)到Java的绑定,我正在寻找特定的案例来检查我的实现是否正常工作。

我对是否应该直接访问字段的讨论不感兴趣(我的绑定无论如何都生成getter和setter,因为Haskell中只有函数)。

那么:你知道java标准库中任何类中的任何非final,static或non-static字段吗?

2 个答案:

答案 0 :(得分:3)

查看java.awt包中的一些几何类型,例如Pointxy字段。

答案 1 :(得分:1)

java.awt.Dimension.height
java.awt.Dimension.width
java.awt.Event.arg
java.awt.Event.clickCount
java.awt.Event.evt
java.awt.Event.id
java.awt.Event.key
java.awt.Event.modifiers
java.awt.Event.target
java.awt.Event.when
java.awt.Event.x
java.awt.Event.y
java.awt.GridBagConstraints.anchor
java.awt.GridBagConstraints.fill
java.awt.GridBagConstraints.gridheight
java.awt.GridBagConstraints.gridwidth
java.awt.GridBagConstraints.gridx
java.awt.GridBagConstraints.gridy
java.awt.GridBagConstraints.insets
java.awt.GridBagConstraints.ipadx
java.awt.GridBagConstraints.ipady
java.awt.GridBagConstraints.weightx
java.awt.GridBagConstraints.weighty
java.awt.GridBagLayout.columnWeights
java.awt.GridBagLayout.columnWidths
java.awt.GridBagLayout.rowHeights
java.awt.GridBagLayout.rowWeights
java.awt.Insets.bottom
java.awt.Insets.left
java.awt.Insets.right
java.awt.Insets.top
java.awt.Point.x
java.awt.Point.y
java.awt.Polygon.npoints
java.awt.Polygon.xpoints
java.awt.Polygon.ypoints
java.awt.Rectangle.height
java.awt.Rectangle.width
java.awt.Rectangle.x
java.awt.Rectangle.y
java.awt.geom.Arc2D$Double.extent
java.awt.geom.Arc2D$Double.height
java.awt.geom.Arc2D$Double.start
java.awt.geom.Arc2D$Double.width
java.awt.geom.Arc2D$Double.x
java.awt.geom.Arc2D$Double.y
java.awt.geom.Arc2D$Float.extent
java.awt.geom.Arc2D$Float.height
java.awt.geom.Arc2D$Float.start
java.awt.geom.Arc2D$Float.width
java.awt.geom.Arc2D$Float.x
java.awt.geom.Arc2D$Float.y
java.awt.geom.CubicCurve2D$Double.ctrlx1
java.awt.geom.CubicCurve2D$Double.ctrlx2
java.awt.geom.CubicCurve2D$Double.ctrly1
java.awt.geom.CubicCurve2D$Double.ctrly2
java.awt.geom.CubicCurve2D$Double.x1
java.awt.geom.CubicCurve2D$Double.x2
java.awt.geom.CubicCurve2D$Double.y1
java.awt.geom.CubicCurve2D$Double.y2
java.awt.geom.CubicCurve2D$Float.ctrlx1
java.awt.geom.CubicCurve2D$Float.ctrlx2
java.awt.geom.CubicCurve2D$Float.ctrly1
java.awt.geom.CubicCurve2D$Float.ctrly2
java.awt.geom.CubicCurve2D$Float.x1
java.awt.geom.CubicCurve2D$Float.x2
java.awt.geom.CubicCurve2D$Float.y1
java.awt.geom.CubicCurve2D$Float.y2
java.awt.geom.Ellipse2D$Double.height
java.awt.geom.Ellipse2D$Double.width
java.awt.geom.Ellipse2D$Double.x
java.awt.geom.Ellipse2D$Double.y
java.awt.geom.Ellipse2D$Float.height
java.awt.geom.Ellipse2D$Float.width
java.awt.geom.Ellipse2D$Float.x
java.awt.geom.Ellipse2D$Float.y
java.awt.geom.Line2D$Double.x1
java.awt.geom.Line2D$Double.x2
java.awt.geom.Line2D$Double.y1
java.awt.geom.Line2D$Double.y2
java.awt.geom.Line2D$Float.x1
java.awt.geom.Line2D$Float.x2
java.awt.geom.Line2D$Float.y1
java.awt.geom.Line2D$Float.y2
java.awt.geom.Point2D$Double.x
java.awt.geom.Point2D$Double.y
java.awt.geom.Point2D$Float.x
java.awt.geom.Point2D$Float.y
java.awt.geom.QuadCurve2D$Double.ctrlx
java.awt.geom.QuadCurve2D$Double.ctrly
java.awt.geom.QuadCurve2D$Double.x1
java.awt.geom.QuadCurve2D$Double.x2
java.awt.geom.QuadCurve2D$Double.y1
java.awt.geom.QuadCurve2D$Double.y2
java.awt.geom.QuadCurve2D$Float.ctrlx
java.awt.geom.QuadCurve2D$Float.ctrly
java.awt.geom.QuadCurve2D$Float.x1
java.awt.geom.QuadCurve2D$Float.x2
java.awt.geom.QuadCurve2D$Float.y1
java.awt.geom.QuadCurve2D$Float.y2
java.awt.geom.Rectangle2D$Double.height
java.awt.geom.Rectangle2D$Double.width
java.awt.geom.Rectangle2D$Double.x
java.awt.geom.Rectangle2D$Double.y
java.awt.geom.Rectangle2D$Float.height
java.awt.geom.Rectangle2D$Float.width
java.awt.geom.Rectangle2D$Float.x
java.awt.geom.Rectangle2D$Float.y
java.awt.geom.RoundRectangle2D$Double.archeight
java.awt.geom.RoundRectangle2D$Double.arcwidth
java.awt.geom.RoundRectangle2D$Double.height
java.awt.geom.RoundRectangle2D$Double.width
java.awt.geom.RoundRectangle2D$Double.x
java.awt.geom.RoundRectangle2D$Double.y
java.awt.geom.RoundRectangle2D$Float.archeight
java.awt.geom.RoundRectangle2D$Float.arcwidth
java.awt.geom.RoundRectangle2D$Float.height
java.awt.geom.RoundRectangle2D$Float.width
java.awt.geom.RoundRectangle2D$Float.x
java.awt.geom.RoundRectangle2D$Float.y
java.beans.beancontext.BeanContextChildSupport.beanContextChildPeer
java.io.InterruptedIOException.bytesTransferred
java.io.InvalidClassException.classname
java.io.OptionalDataException.eof
java.io.OptionalDataException.length
java.io.StreamTokenizer.nval
java.io.StreamTokenizer.sval
java.io.StreamTokenizer.ttype
java.io.WriteAbortedException.detail
java.rmi.RemoteException.detail
java.rmi.activation.ActivationException.detail
java.rmi.server.ServerCloneException.detail
java.sql.DriverPropertyInfo.choices
java.sql.DriverPropertyInfo.description
java.sql.DriverPropertyInfo.name
java.sql.DriverPropertyInfo.required
java.sql.DriverPropertyInfo.value
javax.accessibility.AccessibleAttributeSequence.attributes
javax.accessibility.AccessibleAttributeSequence.endIndex
javax.accessibility.AccessibleAttributeSequence.startIndex
javax.accessibility.AccessibleTextSequence.endIndex
javax.accessibility.AccessibleTextSequence.startIndex
javax.accessibility.AccessibleTextSequence.text
javax.sound.midi.VoiceStatus.active
javax.sound.midi.VoiceStatus.bank
javax.sound.midi.VoiceStatus.channel
javax.sound.midi.VoiceStatus.note
javax.sound.midi.VoiceStatus.program
javax.sound.midi.VoiceStatus.volume
javax.swing.SizeRequirements.alignment
javax.swing.SizeRequirements.maximum
javax.swing.SizeRequirements.minimum
javax.swing.SizeRequirements.preferred
javax.swing.plaf.basic.BasicMenuUI$ChangeHandler.isSelected
javax.swing.plaf.basic.BasicMenuUI$ChangeHandler.menu
javax.swing.plaf.basic.BasicMenuUI$ChangeHandler.ui
javax.swing.plaf.basic.BasicMenuUI$ChangeHandler.wasFocused
javax.swing.text.JTextComponent$KeyBinding.actionName
javax.swing.text.JTextComponent$KeyBinding.key
javax.swing.text.Segment.array
javax.swing.text.Segment.count
javax.swing.text.Segment.offset
javax.swing.text.html.parser.AttributeList.modifier
javax.swing.text.html.parser.AttributeList.name
javax.swing.text.html.parser.AttributeList.next
javax.swing.text.html.parser.AttributeList.type
javax.swing.text.html.parser.AttributeList.value
javax.swing.text.html.parser.AttributeList.values
javax.swing.text.html.parser.ContentModel.content
javax.swing.text.html.parser.ContentModel.next
javax.swing.text.html.parser.ContentModel.type
javax.swing.text.html.parser.DTD.elementHash
javax.swing.text.html.parser.DTD.elements
javax.swing.text.html.parser.DTD.entityHash
javax.swing.text.html.parser.DTD.name
javax.swing.text.html.parser.Element.atts
javax.swing.text.html.parser.Element.content
javax.swing.text.html.parser.Element.data
javax.swing.text.html.parser.Element.exclusions
javax.swing.text.html.parser.Element.inclusions
javax.swing.text.html.parser.Element.index
javax.swing.text.html.parser.Element.name
javax.swing.text.html.parser.Element.oEnd
javax.swing.text.html.parser.Element.oStart
javax.swing.text.html.parser.Element.type
javax.swing.text.html.parser.Entity.data
javax.swing.text.html.parser.Entity.name
javax.swing.text.html.parser.Entity.type
javax.transaction.xa.XAException.errorCode
javax.xml.ws.Holder.value

其中一些显然是WTF。