Skip to content

Commit

Permalink
airframe-surface: Do not traverse non-public constructor (#2199)
Browse files Browse the repository at this point in the history
  • Loading branch information
xerial committed May 28, 2022
1 parent edec851 commit 558e981
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
@@ -0,0 +1,30 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package wvlet.airframe.http.grpc

import io.grpc.{Channel, ServerServiceDefinition}
import wvlet.airframe.surface.Surface
import wvlet.airspec.AirSpec

object GrpcSurfaceTest extends AirSpec {

test("build Surface related to gRPC") {
// ....
Surface.of[ServerServiceDefinition]
Surface.of[GrpcService]
Surface.of[Channel]
Surface.of[GrpcServerConfig]
Surface.of[GrpcServer]
}
}
Expand Up @@ -260,7 +260,7 @@ private[surface] class CompileTimeSurfaceFactory[Q <: Quotes](using quotes: Q) {
private def genericTypeWithConstructorFactory: Factory = {
case t
if !t.typeSymbol.flags.is(Flags.Abstract) && !t.typeSymbol.flags.is(Flags.Trait)
&& Option(t.typeSymbol.primaryConstructor).exists(p => p.exists && p.paramSymss.nonEmpty) =>
&& Option(t.typeSymbol.primaryConstructor).exists(p => p.exists && !p.flags.is(Flags.Private) && p.paramSymss.nonEmpty) =>
val typeArgs = typeArgsOf(t.simplified).map(surfaceOf(_))
val methodParams = constructorParametersOf(t)
val isStatic = !t.typeSymbol.flags.is(Flags.Local)
Expand Down

0 comments on commit 558e981

Please sign in to comment.