Skip to content

private vars need to be excluded consistently #33

Open
@squito

Description

@squito

Excluding private does not work consistently right now. I have a feeling that its just not possible to do this correctly, because of the fact that we're looking at scala vars through java reflection. Which means we should just never try to exclude fields b/c they are private. (If we could consistently exclude private fields, then that would be better.)

Basically, it works for fields defined in a class, but not traits:

import com.quantifind.sumac.{Arg,FieldArgs,Ignore}

def hasX(a: FieldArgs): Boolean = {
  a.getArgs("").find{_.getName.endsWith("x")}.isDefined
}

trait Foo extends FieldArgs {
  private var x = 5
}
class Blah extends FieldArgs {
  private var x = 5
}
class Bippy extends Foo

hasX(new Foo{}) // true
hasX(new Blah()) // false
hasX(new Bipppy()) // true

I'm not sure if this was always broken, or if it happened with the upgrade to 2.10 and we didn't notice it, or if it was a code change. (I don't think it was a code change.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions