diff --git a/shared/src/main/scala-3/org/scalamock/clazz/MockMaker.scala b/shared/src/main/scala-3/org/scalamock/clazz/MockMaker.scala index 76930da7..24e1cb76 100644 --- a/shared/src/main/scala-3/org/scalamock/clazz/MockMaker.scala +++ b/shared/src/main/scala-3/org/scalamock/clazz/MockMaker.scala @@ -124,7 +124,8 @@ private[clazz] object MockMaker: privateWithin = Symbol.noSymbol ) - List(mockFunctionSym, overrideSym) + if (definition.symbol.flags.is(Flags.Artifact)) Nil + else List(mockFunctionSym, overrideSym) }, selfType = None ) @@ -143,7 +144,9 @@ private[clazz] object MockMaker: ClassDef( cls = classSymbol, parents = parents, - body = defaultMockName :: mockableDefinitions.flatMap { definition => + body = defaultMockName :: mockableDefinitions.flatMap { + case definition if definition.symbol.flags.is(Flags.Artifact) => Nil + case definition => val mockFunctionValDef: ValDef = val valSym = classSymbol.declaredField(definition.mockValName) val mockFunctionClassSymbol = valSym.typeRef.classSymbol.get diff --git a/shared/src/test/scala/org/scalamock/test/scalatest/AbstractOverrideMethodTest.scala b/shared/src/test/scala/org/scalamock/test/scalatest/AbstractOverrideMethodTest.scala index ca8e9c55..023c5b2d 100644 --- a/shared/src/test/scala/org/scalamock/test/scalatest/AbstractOverrideMethodTest.scala +++ b/shared/src/test/scala/org/scalamock/test/scalatest/AbstractOverrideMethodTest.scala @@ -1,3 +1,23 @@ +// Copyright (c) 2011-2015 ScalaMock Contributors (https://github.com/paulbutcher/ScalaMock/graphs/contributors) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + package org.scalamock.test.scalatest import org.scalamock.scalatest.MockFactory